Changes between Initial Version and Version 1 of S3/S3Log


Ignore:
Timestamp:
02/16/14 21:25:40 (11 years ago)
Author:
redsin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • S3/S3Log

    v1 v1  
     1= S3Log =
     2[[TOC]]
     3
     4== Purpose ==
     5
     6S3Log is a simple global logging facility for Sahana Eden.
     7
     8== Logger ==
     9
     10The logger is called like:
     11{{{#!python
     12current.log.error("Something went wrong", value="Example")
     13}}}
     14Which gives a log entry like:
     15{{{
     162014-02-16 11:58:41 S3LOG ERROR: Something went wrong: Example
     17}}}
     18The logger functions correspond to the severity level of the message:
     19 - current.log.critical() (highest)
     20 - current.log.error()
     21 - current.log.warning()
     22 - current.log.info()
     23 - current.log.debug() (lowest)
     24The call signature of all logger functions is identical with the example above.
     25
     26== Configuration ==
     27
     28The logger can be configured in models/000_config:
     29{{{#!python
     30# Configure the log level ("DEBUG", "INFO", "WARNING", "ERROR" or "CRITICAL"), None = turn off logging
     31#settings.log.level = None
     32# Uncomment to write log messages to the console (sys.stderr)
     33#settings.log.console = True
     34# Configure a log file (file name)
     35#settings.log.logfile = None
     36# Uncomment to get detailed caller information
     37#settings.log.caller_info = True
     38}}}
     39
     40=== Log Level ===
     41
     42{{{#!python
     43settings.log.level = "DEBUG"
     44}}}
     45determines the minimum severity level at which messages will be logged.
     46
     47Severity levels:
     48 - CRITICAL (highest)
     49 - ERROR
     50 - WARNING
     51 - INFO
     52 - DEBUG (lowest)
     53 - None turns all logging off.
     54
     55=== Console ===
     56
     57{{{#!python
     58settings.log.console = True
     59}}}
     60enables logging to the system error console (sys.stderr).
     61False disables console logging.
     62
     63=== Log File ===
     64
     65{{{#!python
     66settings.log.logfile = "/var/log/eden.log"
     67}}}
     68enables logging to the specified file. The logger rotates 3 log files with a maximum size of 1MB: /var/log/eden.log, /var/log/eden.log.1 and /var/log/eden.log.2
     69None disables logging to file.
     70
     71=== Caller Info ===
     72
     73With settings.log.caller_info = True, the log messages will include information about the origin of the log message (file name, line number, function name):
     74{{{
     752014-02-16 11:58:23 (applications/eden/modules/s3/s3rest.py 477 __init__) ERROR: Something went wrong: Example
     76}}}