import logging
from logging import DEBUG, INFO, WARNING, ERROR, CRITICAL, NOTSET
-from logging.handlers import RotatingFileHandler
+from logging.handlers import RotatingFileHandler, SysLogHandler
from math import log10, floor
import sys
formatter.add_level(notice, 'note')
logger.log(notice, 'more important than info but no warning nor error')
- .. seealso:: testing funcion :py:func:`test_short_level_format`
+ .. seealso:: testing function :py:func:`test_short_level_format`
"""
def __init__(self, fmt=DEFAULT_SHORT_LEVEL_FORMAT,
* Simplifies setting of logger's logging level using
:py:meth:`Logger.set_level`. The level is kept in sync between logger and
handlers and can be queried using :py:meth:`get_level`
- (does not work accross logger hierarchies!)
+ (does not work across logger hierarchies!)
* can specify name and level and [date]fmt all in constructor
* can limit the number of lines this logger will produce to prevent filling
hard drive with log file
:py:class:`logging.handlers.RotatingFileHandler` to avoid huge log
files filling up the disc in case of error.
+ :param str filename: path to file that logger should write to
:param str mode: Mode with which to open log file; forwarded to handler
:param int max_bytes: Max size in bytes of a log file before it is
renamed to `[filename].1` and logging continues
with an empty `[filename]`.
- :param int max_rots: Max number of rotated files to keep
+ :param int max_rotations: Max number of rotated files to keep
:param dict kwargs: All other args (e.g. `encoding`) are forwarded to
handler constructor. `maxBytes` and `backupCount`
are overwritten with `max_bytes` and `max_rots`.
Returns the number of digits a number has in decimal format
:returns: 1 for 1...9, 2 for 10...99, 3 for 100...999, ...
- 0 for 0 (and everything else beween -1 and 1)
+ 0 for 0 (and everything else between -1 and 1)
1 for -1...-9, 2 for -10...-99, ...
"""
if abs(number) < 1: