loggers ¤
Logging functions.
Classes:
-
LoggerAdapter
–A logger adapter to prefix messages.
-
TemplateLogger
–A wrapper class to allow logging in templates.
Functions:
-
get_logger
–Return a pre-configured logger.
-
get_template_logger
–Return a logger usable in templates.
-
get_template_logger_function
–Create a wrapper function that automatically receives the Jinja template context.
-
get_template_path
–Return the path to the template currently using the given context.
LoggerAdapter ¤
Bases: LoggerAdapter
A logger adapter to prefix messages.
Parameters:
-
prefix
(str
) –The string to insert in front of every message.
-
logger
(Logger
) –The logger instance.
Methods:
-
process
–Process the message.
Source code in src/mkdocstrings/loggers.py
30 31 32 33 34 35 36 37 38 |
|
process ¤
Process the message.
Parameters:
-
msg
(str
) –The message:
-
kwargs
(MutableMapping[str, Any]
) –Remaining arguments.
Returns:
Source code in src/mkdocstrings/loggers.py
40 41 42 43 44 45 46 47 48 49 50 |
|
TemplateLogger ¤
TemplateLogger(logger: LoggerAdapter)
A wrapper class to allow logging in templates.
Attributes:
-
debug
–Function to log a DEBUG message.
-
info
–Function to log an INFO message.
-
warning
–Function to log a WARNING message.
-
error
–Function to log an ERROR message.
-
critical
–Function to log a CRITICAL message.
Parameters:
-
logger
(LoggerAdapter
) –A logger adapter.
Source code in src/mkdocstrings/loggers.py
64 65 66 67 68 69 70 71 72 73 74 |
|
get_logger ¤
get_logger(name: str) -> LoggerAdapter
Return a pre-configured logger.
Parameters:
-
name
(str
) –The name to use with
logging.getLogger
.
Returns:
-
LoggerAdapter
–A logger configured to work well in MkDocs.
Source code in src/mkdocstrings/loggers.py
126 127 128 129 130 131 132 133 134 135 136 |
|
get_template_logger ¤
get_template_logger() -> TemplateLogger
Return a logger usable in templates.
Returns:
-
TemplateLogger
–A template logger.
Source code in src/mkdocstrings/loggers.py
139 140 141 142 143 144 145 |
|
get_template_logger_function ¤
Create a wrapper function that automatically receives the Jinja template context.
Parameters:
-
logger_func
(Callable
) –The logger function to use within the wrapper.
Returns:
-
Callable
–A function.
Source code in src/mkdocstrings/loggers.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
get_template_path ¤
get_template_path(context: Context) -> str
Return the path to the template currently using the given context.
Parameters:
-
context
(Context
) –The template context.
Returns:
-
str
–The relative path to the template.
Source code in src/mkdocstrings/loggers.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
|