pythonhacker / harvestman-crawler

Automatically exported from code.google.com/p/harvestman-crawler
1 stars 3 forks source link

Modify logging to confirm to standards #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Replace the current custom logging levels with
standard logging level, with an additional custom level.

The current levels are,

DISABLE => Level 0, No logging
INFO => Level 1 logging
MOREINFO => Level 2 logging
EXTRAINFO => Level 3 logging
DEBUG => Level 4, Maximum logging

Errors are always logged. 

This should be replaced with

DISABLE => Level 0, no logging
CRITICAL => Level 1, only critical messages
ERROR => Level 2, only error messages
WARNING => Level 3, only warning messages
INFO => Level 4, informational messages 
EXTRAINFO => Level 5, additional informational messages
DEBUG => Level 6, maximum logging (log all), including developer debug messages

Additionally, add loglevel strings in the log messages ("DEBUG", "INFO"
etc) in the log file, which we are not doing now. 

Additionally, perhaps it is a good idea to specify the logging level
(verbosity) as a string ("DEBUG", "INFO" etc) instead of as a number
(0,1,2,3) as we are doing now. 

Soliciting feedbacks...

Original issue reported on code.google.com by abpil...@gmail.com on 4 Jul 2008 at 12:44

GoogleCodeExporter commented 9 years ago
Below are the standard messages. I would use these from highest to lowest. I 
think as
long as we specify, explain what each of these mean then we are should be good. 
I
also think we should stick with 5 max just like you have it implemented now, 
just
replace the names.

http://docs.python.org/lib/module-logging.htmlhttp://docs.python.org/lib/module-
logging.html

"The numeric values of logging levels are given in the following table. These 
are
primarily of interest if you want to define your own levels, and need them to 
have
specific values relative to the predefined levels. If you define a level with 
the
same numeric value, it overwrites the predefined value; the predefined name is 
lost."

Here are the names and values. You have listed it differently, so here they are.
CRITICAL 50
ERROR   40
WARNING 30
INFO    20
DEBUG   10
NOTSET  0

Original comment by szybal...@gmail.com on 4 Jul 2008 at 9:35

GoogleCodeExporter commented 9 years ago

Original comment by abpil...@gmail.com on 7 Jul 2008 at 8:17

GoogleCodeExporter commented 9 years ago
OK, then our levels would be,

CRITICAL 50
ERROR   40
WARNING 30
INFO    20
EXTRAINFO 15
DEBUG   10
NOTSET/DISABLE  0

Original comment by abpil...@gmail.com on 10 Jul 2008 at 2:34

GoogleCodeExporter commented 9 years ago
Fixed the issue. Modified logging to add the above levels and replaced old 
levels.
Changed all code to use these log levels. Also modified config.xml parsing 
accordingly.

Also changed the XML attribute for logging. It is no longer
<verbosity value="..." />, but instead,

<verbosity level="..."/>

The level can be specified as a string i.e one of 
"debug","info",'extrainfo','warning','error' and 'critical' or
the corresponding actual numbers.

SVN revisions for the fix => 74 and 75.

Original comment by abpil...@gmail.com on 13 Jul 2008 at 8:27