On Tuesday, 14 February 2012 at 01:58:50 UTC, Jose Armando Garcia
wrote:
I am trying to minimize the number of predefined log levels.
One of
the big problems I see with having too many log levels is that
the
programmer never knows which one to use. I think std.log makes
this
very clear:
1. Log at fatal if you want the application to assert
2. Log at critical if you want the thread to throw
3. Log at error if you detect a programming bug (invariant
violation)
but you wish to continue and cross your finger
4. Log at warning if you detected peculiar condition yet the
program
was coded to handle it.
5. Log at info if you want to document an action/state.
6. verbose log for trace/debugging specific parts of a program.
I think it would help me that instead of suggesting another
level we
instead state what we think the user would like to do or log
but the
framework as defined doesn't let the user do.
In my applications I want my logs to be human readable by users
and/or admins.
I tend to have different kinds of what you call warnings.
Say my app uploads a file by FTP. It would be something like:
info("sending file to host")
and then
case a:
info("file sent successfully - took time x")
case b:
warning("encountered some FTP problems") info("file sent
successfully - took time x")
case c:
warning("encountered severe FTP problems - could not send file")
The program can handle all three cases.
But I want to clearly communicate to the user the different
severity of the problems the program handled. BTW I normally call
case c "error" (from the users perspective).