certdeploy package¶
Subpackages¶
Submodules¶
certdeploy.errors module¶
Module contents¶
Shared CertDeploy code.
- class certdeploy.LogLevel(value)[source]¶
Bases:
EnumLogging levels and utilities.
- CRITICAL = 'CRITICAL'¶
- DEBUG = 'DEBUG'¶
- ERROR = 'ERROR'¶
- INFO = 'INFO'¶
- WARNING = 'WARNING'¶
- class certdeploy.Logger(name: str)[source]¶
Bases:
objectA logging helper with some modified behavior.
- Parameters:
name – The name of the logging.Logger.
- error(*args: Any, exc_info=None, **kwargs)[source]¶
Log an error message.
See logging.error for details. This method differs from logging.error in the following ways:
- If the first argument is an exception it’s formatted so the type
is given and not just the message.
exc_info is ignored if the log level is anything but DEBUG.
- certdeploy.format_error(err: Exception, message_format: str = '{name}: {message}') str[source]¶
Format errors consistently.
- Parameters:
err – The exception to format.
message_format – The format string (.format style) to apply the error to. The keys name and message are passed to the format string. Defaults to ‘{name}: {message}’.
- Returns:
A formatted string with the name and message of the given error.
- certdeploy.set_log_properties(logger_name: str, log_filename: PathLike, log_level: int | str | LogLevel | None = None, msg_format: str = '%(levelname)s:%(name)s: %(message)s', date_format: str = '%Y.%m.%d-%H:%M:%S')[source]¶
Set logger properties.
- Parameters:
logger_name – The name of the logger.
log_filename – The path to the log file.
log_level – The desired log level. Defaults to LogLevel.ERROR.
msg_format – The format for the each log entry. Defaults to DEFAULT_LOG_FORMAT.
date_format – The date format for each log entry. This is only used if the msg_format has the date in it. Defaults to DEFAULT_LOG_DATE_FORMAT.
- certdeploy.set_paramiko_log_properties(log_filename: PathLike | None = None, log_level: int | str | LogLevel | None = None, msg_format: str = '%(levelname)s:%(name)s: %(message)s', date_format: str = '%Y.%m.%d-%H:%M:%S')[source]¶
Set the paramiko logger properties.
- Parameters:
log_filename – The path to the log file.
log_level – The desired log level. Defaults to LogLevel.ERROR.
msg_format – The format for the each log entry. Defaults to DEFAULT_LOG_FORMAT.
date_format – The date format for each log entry. This is only used if the msg_format has the date in it. Defaults to DEFAULT_LOG_DATE_FORMAT.