Logging
pokelance.logger
⚓︎
FileHandler(*, ext, folder='logs')
⚓︎
Bases: FileHandler
Emit a log record.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ext |
str
|
The file extension. |
required |
folder |
Path | str
|
The folder to save the logs in. Defaults to "logs". |
'logs'
|
Create a new file handler.
Source code in pokelance/logger.py
emit(record)
⚓︎
Emit a log record.
Source code in pokelance/logger.py
Logger(*, name, level=logging.DEBUG, file_logging=False)
⚓︎
Bases: Logger
The logger used to log information about the client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The name of the logger. |
required |
level |
int
|
The level of the logger. |
DEBUG
|
file_logging |
bool
|
Whether or not to log to a file. |
False
|
Attributes:
Name | Type | Description |
---|---|---|
_handler |
StreamHandler
|
The stream handler used to log to the console. |
_file_handler |
Optional[FileHandler]
|
The file handler used to log to a file. |
Examples:
Python Console Session
>>> logs = Logger(name="pokelance")
>>> logs.info("Hello, world!")
[2021-08-29 17:05:32,000] | pokelance/logger.py:95 | INFO | Hello, world!