Logging - vcspull.log¶
Log utilities for formatting CLI output in vcspull.
This module containers special formatters for processing the additional context
information from libvcs.base.RepoLoggingAdapter.
Colorized formatters for generic logging inside the application is also provided.
- vcspull.log.setup_logger(log=None, level='INFO')[source]¶
Configure the vcspull logging hierarchy once and reuse it everywhere.
- class vcspull.log.LogFormatter(color=True, **kwargs)[source]¶
Bases:
FormatterLog formatting for vcspull.
Initialize the formatter with specified format strings.
Initialize the formatter either with the specified format string, or a default as described above. Allow for specialized date formatting with the optional datefmt argument. If datefmt is omitted, you get an ISO8601-like (or RFC 3339-like) format.
Use a style parameter of ‘%’, ‘{’ or ‘$’ to specify that you want to use one of %-formatting,
str.format()({}) formatting orstring.Templateformatting in your format string.Changed in version 3.2: Added the
styleparameter.- Parameters:
color (bool)
kwargs (t.Any)
- template(record)[source]¶
Return the prefix for the log message. Template for Formatter.
- Return type:
- Parameters:
record (
logging.LogRecord) – Passed in from inside thelogging.Formatter.format()record.
- class vcspull.log.DebugLogFormatter(color=True, **kwargs)[source]¶
Bases:
LogFormatterProvides greater technical details than standard log Formatter.
Initialize the formatter with specified format strings.
Initialize the formatter either with the specified format string, or a default as described above. Allow for specialized date formatting with the optional datefmt argument. If datefmt is omitted, you get an ISO8601-like (or RFC 3339-like) format.
Use a style parameter of ‘%’, ‘{’ or ‘$’ to specify that you want to use one of %-formatting,
str.format()({}) formatting orstring.Templateformatting in your format string.Changed in version 3.2: Added the
styleparameter.- Parameters:
color (bool)
kwargs (t.Any)
- template(record)[source]¶
Return the prefix for the log message. Template for Formatter.
- Return type:
- Parameters:
record (
logging.LogRecord) – Passed from inside thelogging.Formatter.format()record.
- class vcspull.log.RepoLogFormatter(color=True, **kwargs)[source]¶
Bases:
LogFormatterLog message for VCS repository.
Initialize the formatter with specified format strings.
Initialize the formatter either with the specified format string, or a default as described above. Allow for specialized date formatting with the optional datefmt argument. If datefmt is omitted, you get an ISO8601-like (or RFC 3339-like) format.
Use a style parameter of ‘%’, ‘{’ or ‘$’ to specify that you want to use one of %-formatting,
str.format()({}) formatting orstring.Templateformatting in your format string.Changed in version 3.2: Added the
styleparameter.- Parameters:
color (bool)
kwargs (t.Any)
- class vcspull.log.SimpleLogFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)[source]¶
Bases:
FormatterSimple formatter that outputs only the message, like print().
Initialize the formatter with specified format strings.
Initialize the formatter either with the specified format string, or a default as described above. Allow for specialized date formatting with the optional datefmt argument. If datefmt is omitted, you get an ISO8601-like (or RFC 3339-like) format.
Use a style parameter of ‘%’, ‘{’ or ‘$’ to specify that you want to use one of %-formatting,
str.format()({}) formatting orstring.Templateformatting in your format string.Changed in version 3.2: Added the
styleparameter.