Review of Jose Armando Garcia Sancio's std.log
heiko.honrath at gmx.de
Thu Feb 16 03:42:55 PST 2012
On Tuesday, 14 February 2012 at 01:58:50 UTC, Jose Armando Garcia
> 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
> programmer never knows which one to use. I think std.log makes
> 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
> but you wish to continue and cross your finger
> 4. Log at warning if you detected peculiar condition yet the
> 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
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")
info("file sent successfully - took time x")
warning("encountered some FTP problems") info("file sent
successfully - took time x")
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).
More information about the Digitalmars-d