Skip to content

[Feature] Logging to file. #1441

@lastrosade

Description

@lastrosade

Feature Summary

The strangely missing log to file feature.

Detailed Description

I can't believe it took me this long to realize there's no log to file CLI argument.
I am currently trying to test perf on various models and settings.
Using tee leads to the dreaded stairs of doom:

Stairs We even get broken unicode for free!
�[34;1m[INFO ]�[0m 
  |>                                                 | 37/2560 - 0.18MB/s�[K
  |=>                                                | 54/2560 - 0.55MB/s�[K
  |=>                                                | 79/2560 - 133.21MB/s�[K
  |==>                                               | 106/2560 - 225.33MB/s�[K
  |==>                                               | 131/2560 - 320.61MB/s�[K
  |===>                                              | 160/2560 - 450.98MB/s�[K
  |===>                                              | 189/2560 - 617.20MB/s�[K
  |===>                                              | 199/2560 - 589.36MB/s�[K
  |====>                                             | 224/2560 - 642.52MB/s�[K
  |====>                                             | 241/2560 - 672.01MB/s�[K
  |====>                                             | 255/2560 - 680.97MB/s�[K
  |=====>                                            | 278/2560 - 719.85MB/s�[K
  |=====>                                            | 297/2560 - 730.92MB/s�[K
  |=====>                                            | 307/2560 - 707.33MB/s�[K
  |======>                                           | 334/2560 - 761.13MB/s�[K
  |======>                                           | 357/2560 - 817.48MB/s�[K
  |=======>                                          | 376/2560 - 820.40MB/s�[K
  |=======>                                          | 397/2560 - 819.32MB/s�[K
  |========>                                         | 415/2560 - 813.49MB/s�[K
  |========>                                         | 440/2560 - 843.40MB/s�[K
  |========>                                         | 457/2560 - 848.24MB/s�[K
  |=========>                                        | 461/2560 - 826.50MB/s�[K
  |=========>                                        | 478/2560 - 816.68MB/s�[K
  |=========>                                        | 505/2560 - 845.65MB/s�[K
  |==========>                                       | 527/2560 - 861.64MB/s�[K
  |==========>                                       | 542/2560 - 854.29MB/s�[K
  |===========>                                      | 568/2560 - 866.04MB/s�[K
  |===========>                                      | 579/2560 - 855.48MB/s�[K
  |===========>                                      | 602/2560 - 859.46MB/s�[K
  |============>                                     | 623/2560 - 857.37MB/s�[K
  |============>                                     | 646/2560 - 871.88MB/s�[K
  |============>                                     | 658/2560 - 865.72MB/s�[K
  |=============>                                    | 675/2560 - 867.87MB/s�[K
  |=============>                                    | 694/2560 - 868.09MB/s�[K
  |=============>                                    | 714/2560 - 866.41MB/s�[K
  |==============>                                   | 735/2560 - 871.38MB/s�[K
  |==============>                                   | 748/2560 - 865.95MB/s�[K
  |===============>                                  | 779/2560 - 881.22MB/s�[K
  |===============>                                  | 789/2560 - 873.47MB/s�[K
  |===============>                                  | 812/2560 - 890.97MB/s�[K
  |================>                                 | 833/2560 - 890.58MB/s�[K
  |================>                                 | 849/2560 - 890.22MB/s�[K
  |=================>                                | 877/2560 - 895.33MB/s�[K
  |=================>                                | 891/2560 - 887.94MB/s�[K
  |=================>                                | 901/2560 - 876.91MB/s�[K
  |==================>                               | 924/2560 - 879.14MB/s�[K
  |==================>                               | 932/2560 - 879.81MB/s�[K
  |==================>                               | 956/2560 - 894.26MB/s�[K
  |===================>                              | 982/2560 - 901.62MB/s�[K
  |===================>                              | 1011/2560 - 909.02MB/s�[K
  |====================>                             | 1028/2560 - 902.80MB/s�[K
  |====================>                             | 1040/2560 - 901.77MB/s�[K
  |====================>                             | 1061/2560 - 904.74MB/s�[K
  |=====================>                            | 1087/2560 - 910.92MB/s�[K
  |=====================>                            | 1095/2560 - 940.30MB/s�[K

  |=====================>                            | 1104/2560 - 940.15MB/s�[K
  |=======================>                          | 1182/2560 - 924.30MB/s�[K
  |=======================>                          | 1199/2560 - 919.10MB/s�[K
  |=======================>                          | 1201/2560 - 905.78MB/s�[K
  |=======================>                          | 1222/2560 - 906.89MB/s�[K
  |========================>                         | 1244/2560 - 909.55MB/s�[K
  |========================>                         | 1269/2560 - 909.35MB/s�[K
  |=========================>                        | 1294/2560 - 911.75MB/s�[K
  |=========================>                        | 1311/2560 - 912.26MB/s�[K
  |=========================>                        | 1330/2560 - 908.99MB/s�[K
  |==========================>                       | 1350/2560 - 910.03MB/s�[K
  |==========================>                       | 1367/2560 - 908.02MB/s�[K
  |===========================>                      | 1388/2560 - 910.10MB/s�[K
  |===========================>                      | 1400/2560 - 906.81MB/s�[K
  |===========================>                      | 1412/2560 - 903.61MB/s�[K
  |===========================>                      | 1433/2560 - 909.22MB/s�[K
  |============================>                     | 1456/2560 - 910.05MB/s�[K
  |============================>                     | 1483/2560 - 917.96MB/s�[K
  |=============================>                    | 1506/2560 - 920.88MB/s�[K
  |=============================>                    | 1523/2560 - 918.95MB/s�[K
  |==============================>                   | 1541/2560 - 919.55MB/s�[K
  |==============================>                   | 1560/2560 - 915.59MB/s�[K
  |==============================>                   | 1579/2560 - 914.98MB/s�[K
  |===============================>                  | 1600/2560 - 919.79MB/s�[K
  |===============================>                  | 1616/2560 - 915.87MB/s�[K
  |================================>                 | 1643/2560 - 923.17MB/s�[K
  |================================>                 | 1658/2560 - 920.07MB/s�[K
  |================================>                 | 1676/2560 - 922.55MB/s�[K
  |=================================>                | 1695/2560 - 920.85MB/s�[K
  |=================================>                | 1712/2560 - 922.97MB/s�[K
  |==================================>               | 1741/2560 - 928.83MB/s�[K
  |==================================>               | 1757/2560 - 928.23MB/s�[K
  |==================================>               | 1780/2560 - 928.66MB/s�[K
  |===================================>              | 1805/2560 - 932.08MB/s�[K
  |===================================>              | 1822/2560 - 932.22MB/s�[K
  |===================================>              | 1838/2560 - 929.65MB/s�[K
  |====================================>             | 1859/2560 - 928.98MB/s�[K
  |====================================>             | 1878/2560 - 930.20MB/s�[K
  |=====================================>            | 1901/2560 - 930.62MB/s�[K
  |=====================================>            | 1917/2560 - 931.71MB/s�[K
  |=====================================>            | 1944/2560 - 934.14MB/s�[K
  |======================================>           | 1967/2560 - 937.88MB/s�[K
  |======================================>           | 1973/2560 - 931.58MB/s�[K
  |======================================>           | 1996/2560 - 933.65MB/s�[K
  |=======================================>          | 2013/2560 - 932.02MB/s�[K
  |=======================================>          | 2025/2560 - 929.53MB/s�[K
  |========================================>         | 2050/2560 - 934.10MB/s�[K
  |========================================>         | 2067/2560 - 930.94MB/s�[K
  |========================================>         | 2082/2560 - 932.01MB/s�[K
  |=========================================>        | 2106/2560 - 933.92MB/s�[K
  |=========================================>        | 2129/2560 - 935.74MB/s�[K
  |=========================================>        | 2148/2560 - 936.79MB/s�[K
  |==========================================>       | 2162/2560 - 933.75MB/s�[K
  |==========================================>       | 2184/2560 - 931.63MB/s�[K
  |==========================================>       | 2190/2560 - 955.70MB/s�[K

  |==========================================>       | 2197/2560 - 955.66MB/s�[K
  |===========================================>      | 2242/2560 - 951.15MB/s�[K
  |===========================================>      | 2249/2560 - 947.55MB/s�[K
  |============================================>     | 2257/2560 - 944.05MB/s�[K
  |============================================>     | 2263/2560 - 942.70MB/s�[K
  |============================================>     | 2273/2560 - 942.83MB/s�[K
  |============================================>     | 2281/2560 - 940.49MB/s�[K
  |============================================>     | 2291/2560 - 939.57MB/s�[K
  |============================================>     | 2298/2560 - 939.43MB/s�[K
  |=============================================>    | 2309/2560 - 941.18MB/s�[K
  |=============================================>    | 2322/2560 - 941.57MB/s�[K
  |=============================================>    | 2329/2560 - 940.32MB/s�[K
  |=============================================>    | 2343/2560 - 943.36MB/s�[K
  |=============================================>    | 2353/2560 - 943.40MB/s�[K
  |==============================================>   | 2363/2560 - 943.48MB/s�[K
  |==============================================>   | 2381/2560 - 947.71MB/s�[K
  |==============================================>   | 2388/2560 - 945.54MB/s�[K
  |==============================================>   | 2398/2560 - 946.54MB/s�[K
  |===============================================>  | 2407/2560 - 945.00MB/s�[K
  |===============================================>  | 2418/2560 - 945.65MB/s�[K
  |===============================================>  | 2428/2560 - 946.67MB/s�[K
  |===============================================>  | 2432/2560 - 952.55MB/s�[K

  |===============================================>  | 2444/2560 - 952.52MB/s�[K
  |==================================================| 2560/2560 - 946.74MB/s�[K

I think it would be beneficiary to include a log to file argument similar to what llama.cpp has, especially now that this project has a functional (WIP but still) server.

These are the flags I am thinking about:

--log-file FNAME                        Log to file
--log-prefix                            Enable prefix in log messages
--log-timestamps                        Enable timestamps in log messages
--log-verbosity N   Set the verbosity threshold. Messages with a higher verbosity will be
                    ignored. Values:
                     - 0: generic output
                     - 1: error
                     - 2: warning
                     - 3: info
                     - 4: debug
                    (default: 1)

If possible, have a separate --verbosity N or --stdout-verbosity N that controls stdout output. So tmux/whatever you use stays clean while the log file fills up.

Alternatives you considered

tee and suffering
powershell + tee + duckdb lmao (I won't share, I am ashamed)

Additional context

inb4 you can do that with env vars, but it's undocumented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions