clarify and expand console log colors help

This commit is contained in:
Justin Findlay 2015-03-26 00:10:55 -06:00
parent c2df42dcf7
commit 294dfe2d94
4 changed files with 59 additions and 8 deletions

View file

@ -54,6 +54,17 @@
#
# http://docs.python.org/library/logging.html#logrecord-attributes
#
# Console log colors are specified by these additional formatters:
#
# %(colorlevel)s
# %(colorname)s
# %(colorprocess)s
# %(colormsg)s
#
# Since it is desirable to include the surrounding brackets, '[' and ']', in
# the coloring of the messages, these color formatters also include padding as
# well. Color LogRecord attributes are only available for console logging.
#
#log_fmt_console: '[%(levelname)-8s] %(message)s'
#log_fmt_logfile: '%(asctime)s,%(msecs)03.0f [%(name)-17s][%(levelname)-8s] %(message)s'

View file

@ -652,8 +652,17 @@
# The format of the console logging messages. Allowed formatting options can
# be seen here: http://docs.python.org/library/logging.html#logrecord-attributes
#
# Console log colors are specified by these special log formatters:
# %(colorlevel), %(colorname), %(colorprocess), %(colormsg).
# Console log colors are specified by these additional formatters:
#
# %(colorlevel)s
# %(colorname)s
# %(colorprocess)s
# %(colormsg)s
#
# Since it is desirable to include the surrounding brackets, '[' and ']', in
# the coloring of the messages, these color formatters also include padding as
# well. Color LogRecord attributes are only available for console logging.
#
#log_fmt_console: '[%(levelname)-8s] %(message)s'
#log_fmt_logfile: '%(asctime)s,%(msecs)03.0f [%(name)-17s][%(levelname)-8s] %(message)s'

View file

@ -509,8 +509,17 @@
# The format of the console logging messages. Allowed formatting options can
# be seen here: http://docs.python.org/library/logging.html#logrecord-attributes
#
# Console log colors are specified by these special log formatters:
# %(colorlevel), %(colorname), %(colorprocess), %(colormsg).
# Console log colors are specified by these additional formatters:
#
# %(colorlevel)s
# %(colorname)s
# %(colorprocess)s
# %(colormsg)s
#
# Since it is desirable to include the surrounding brackets, '[' and ']', in
# the coloring of the messages, these color formatters also include padding as
# well. Color LogRecord attributes are only available for console logging.
#
#log_fmt_console: '[%(levelname)-8s] %(message)s'
#log_fmt_logfile: '%(asctime)s,%(msecs)03.0f [%(name)-17s][%(levelname)-8s] %(message)s'

View file

@ -124,8 +124,22 @@ formatting can be seen on :func:`time.strftime <python2:time.strftime>`.
Default: ``[%(levelname)-8s] %(message)s``
The format of the console logging messages. Allowed formatting options can
be seen on the :ref:`LogRecord attributes <python2:logrecord-attributes>`.
The format of the console logging messages. All standard python logging
:ref:`LogRecord attributes <python2:logrecord-attributes>` can be used. Salt
also provides these custom LogRecord attributes to colorize console log output:
.. code-block:: python
'%(colorlevel)s' # log level name colorized by level
'%(colorname)s' # colorized module name
'%(colorprocess)s' # colorized process number
'%(colormsg)s' # log message colorized by level
.. note::
The ``%(colorlevel)s``, ``%(colorname)s``, and ``%(colorprocess)``
LogRecord attributes also include padding and enclosing brackets, ``[`` and
``]`` to match the default values of their collateral non-colorized
LogRecord attributes.
.. code-block:: yaml
@ -140,8 +154,16 @@ be seen on the :ref:`LogRecord attributes <python2:logrecord-attributes>`.
Default: ``%(asctime)s,%(msecs)03.0f [%(name)-17s][%(levelname)-8s] %(message)s``
The format of the log file logging messages. Allowed formatting options can
be seen on the :ref:`LogRecord attributes <python2:logrecord-attributes>`.
The format of the log file logging messages. All standard python logging
:ref:`LogRecord attributes <python2:logrecord-attributes>` can be used. Salt
also provides these custom LogRecord attributes that include padding and
enclosing brackets ``[`` and ``]``:
.. code-block:: python
'%(bracketlevel)s' # equivalent to [%(levelname)-8s]
'%(bracketname)s' # equivalent to [%(name)-17s]
'%(bracketprocess)s' # equivalent to [%(process)5s]
.. code-block:: yaml