Why Nostr? What is Njump?
2023-12-11 22:19:48
in reply to

Space Hobo on Nostr: npub14wsy6…rdrhu npub1a3hfc…9m44m I discovered a while ago that I could do this ...

I discovered a while ago that I could do this in #Python scripts:

```
if args.syslog or not sys.stdout.isatty():
handler = logging.handlers.SysLogHandler(
address='/dev/log',
facility=logging.handlers.SysLogHandler.LOG_DAEMON)
formatter = logging.Formatter('%(name)s: %(levelname)s %(message)s')
handler.setFormatter(formatter)
mylogger.addHandler(handler)
else: # use the basic config when on terminal
debugLevel = logging.WARNING - (args.verbose * 10)
logging.basicConfig(level=max(debugLevel, 0))
```

This meant I not only got verbosity for free, but all those logged messages on `stderr` would automatically go to syslog if this wasn't run from a terminal. All of a sudden my cron spam dropped and I could use existing tools to analyse problems in the logs.

You could probably also catch `-q` as a quiet option and add that to the log level calculations at the end without more verbosity.
Author Public Key
npub1dayn4yhqczej88j7023hwzrl6e37v0djuxg3cg455l3udqv6rctqllwuks