This one's kind of out of left field, but since I already implemented it locally and find it pretty useful when debugging my spacehammer code without distractions, I figured I'd submit a PR and see if it was something you'd find potentially worth merging 😉. No harm if you close this in the event I'm the only one who finds it useful! Also, let me know if the impl + config field/format looks good or if you'd prefer something different. Thanks!
Usecase
There are times I've found troubleshooting things I do with my config a little unwieldy due to the log noise generated by the modal.fnl/apps.fnl debug logs. Since hammerspoon doesn't do anything special with the logger ID's in terms of managing id -> instance centrally, making each namespaced logger configurable would have required either exporting them each from their relevant modules or storing them in a container.
To simplify things, wrote a small state container for any instantiated loggers in lib/utils.fnl; just a weak-valued table for storing logger instances by ID and a function that either fetches an existing logger by name or instantiates and stores a new one, setting log level if provided.
I then proceeded to add support for a log-levels field in config, which is iterated at startup in core.fnl to override log levels:
This one's kind of out of left field, but since I already implemented it locally and find it pretty useful when debugging my spacehammer code without distractions, I figured I'd submit a PR and see if it was something you'd find potentially worth merging 😉. No harm if you close this in the event I'm the only one who finds it useful! Also, let me know if the impl + config field/format looks good or if you'd prefer something different. Thanks!
Usecase
There are times I've found troubleshooting things I do with my config a little unwieldy due to the log noise generated by the
modal.fnl
/apps.fnl
debug logs. Since hammerspoon doesn't do anything special with the logger ID's in terms of managing id -> instance centrally, making each namespaced logger configurable would have required either exporting them each from their relevant modules or storing them in a container.To simplify things, wrote a small state container for any instantiated loggers in
lib/utils.fnl
; just a weak-valued table for storing logger instances by ID and a function that either fetches an existing logger by name or instantiates and stores a new one, setting log level if provided.I then proceeded to add support for a
log-levels
field in config, which is iterated at startup incore.fnl
to override log levels: