cointop-sh / cointop

A fast and lightweight interactive terminal based UI application for tracking cryptocurrencies 🚀
https://cointop.sh
Apache License 2.0
3.98k stars 311 forks source link

If $DEBUG_FILE is set, use that rather than /tmp/cointop.log #236

Closed lyricnz closed 2 years ago

lyricnz commented 2 years ago

Including support for :PREFERRED_TEMP_DIR: token in paths - using os.TempDir()

179

lyricnz commented 2 years ago
$ DEBUG=1 DEBUG_FILE="spam.log" ./bin/cointop holdings | head -3
        name    symbol     price    holdings     balance     24h%   %holdings
Bitcoin         BTC       195649      0.4832     94537.6    -2.39       42.36
Cardano         ADA         7.03     5267.19    37028.35    -1.68       16.59

$ head -3 spam.log
time="2021-10-17T19:09:00+11:00" level=debug msg="CreateConfigIfNotExists()"
time="2021-10-17T19:09:00+11:00" level=debug msg="ParseConfig()"
time="2021-10-17T19:09:00+11:00" level=debug msg="loadTableConfig()"

$ DEBUG=1 DEBUG_FILE=":PREFERRED_TEMP_DIR:/newfile.log" ./bin/cointop holdings | head -3
Writing debug log to /var/folders/bn/lqwl2y1121lcptjv7n6_zlqh0000gn/T/newfile.log
        name    symbol     price    holdings     balance     24h%   %holdings
Bitcoin         BTC       195649      0.4832     94537.6    -2.39       42.36