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:
Formatter
Log 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.Template
formatting in your format string.Changed in version 3.2: Added the
style
parameter.- 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:
LogFormatter
Provides 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.Template
formatting in your format string.Changed in version 3.2: Added the
style
parameter.- 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:
LogFormatter
Log 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.Template
formatting in your format string.Changed in version 3.2: Added the
style
parameter.- Parameters:
color (bool)
kwargs (t.Any)
- class vcspull.log.SimpleLogFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)[source]¶
Bases:
Formatter
Simple 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.Template
formatting in your format string.Changed in version 3.2: Added the
style
parameter.