Logger
glide.logger.Logger
A singleton class that allows logging which is consistent with logs from the internal rust core. The logger can be set up in 2 ways - 1. By calling Logger.init, which configures the logger only if it wasn't previously configured. 2. By calling Logger.set_logger_config, which replaces the existing configuration, and means that new logs will not be saved with the logs that were sent before the call. If set_logger_config wasn't called, the first log attempt will initialize a new logger with default configuration decided by the Rust core.
Source code in glide/logger.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
init(level=None, file_name=None)
classmethod
summary Initialize a logger if it wasn't initialized before - this method is meant to be used when there is no intention to replace an existing logger. The logger will filter all logs with a level lower than the given level, If given a fileName argument, will write the logs to files postfixed with fileName. If fileName isn't provided, the logs will be written to the console. Args: level (Optional[Level]): Set the logger level to one of [ERROR, WARN, INFO, DEBUG, TRACE, OFF]. If log level isn't provided, the logger will be configured with default configuration decided by the Rust core. file_name (Optional[str]): If provided the target of the logs will be the file mentioned. Otherwise, logs will be printed to the console. To turn off logging completely, set the level to Level.OFF.
Source code in glide/logger.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
log(log_level, log_identifier, message)
classmethod
Logs the provided message if the provided log level is lower then the logger level.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
log_level
|
Level
|
The log level of the provided message |
required |
log_identifier
|
str
|
The log identifier should give the log a context. |
required |
message
|
str
|
The message to log. |
required |
Source code in glide/logger.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
set_logger_config(level=None, file_name=None)
classmethod
Creates a new logger instance and configure it with the provided log level and file name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
level
|
Optional[Level]
|
Set the logger level to one of [ERROR, WARN, INFO, DEBUG, TRACE, OFF]. |
None
|
file_name
|
Optional[str]
|
If provided the target of the logs will be the file mentioned. |
None
|
Source code in glide/logger.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|