Hi all!

This is kinda hard to word, so hopefully this is clear. I'm not really 
demanding a change, but if people agree I think it would be good going 
forwards:

Say you're writing an Elixir library (which may or may not have an 
application started), and you have something which might do something worth 
noting. You don't know if it's relevant yet, but if it happens in userland 
(i.e. when someone downloaded your lib from Hex) it would be good to know, 
even just for context. Think of the use case where someone sees weird 
behaviour and you need to look at these types of logs to check it out; but 
they're too noisy to be on by default. The lowest level we have available 
to us is debug, which still appears by default. Nobody wants potentially 
noisy logs by default.

Therefore, I'd like to suggest any of the following (although I'm really 
opening this thread for a generally good solution):

1. Debug should not log by default (i.e. the default application log level 
should be info). This is very familiar coming from other languages, and 
actually fits the name more (if something logs when you're not debugging, 
it's not a debug log). This is a longer term change as it's obviously 
"breaking".
2. Introduce a new log level designed for this use case (perhaps "trace"?) 
which is off by default (due to the default level being debug); i.e. a user 
has to turn it on to see any of the logs (and they're removed at compile 
time otherwise). This one appears to be straightforward to add in the 1.x 
lineage.
3. ??? you tell me, I'm not really sure how else to deal with it currently.

I'd expect that a lot of readers will jump to the concept of the 
application configuration; but refer to the note that not all libraries 
have an application backing them, and having to add one just for this is a 
pain, along with the inevitable bindings you'll have to add for your 
logging. Add that to the fact that a user has to go out of their way to 
turn them off and it makes it an undesirable solution: "why am I seeing all 
of these logs?!", etc. This wouldn't be an issue with a logging level 
that's hidden by default.

I feel like this is something lacking in the existing Logger, and it 
becomes especially evident when coming from other languages where this is 
straightforward (the "debug" module in Node.js is a good example of what 
I'd like, or any of the Java loggers). I would also note that people 
looking at this issue need to keep the concept of 
libraries/packages/modules in mind; this is not something that's relevant 
in your own projects as you can just change it yourself. 

Thanks (as ever) for all feedback!
IW

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/89b48978-4a74-460a-b9ea-6b4f40d56935%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to