level
Class: Level
The level of the log.
Method: constructor
Instantiates the Level object.
Source
def __init__(self, l_name: str, l_foreground_color: ForegroundColor | str = ForegroundColor.white,
l_background_color: BackgroundColor | str = "", l_effect: Effect | str = ""):
self.name = l_name
self.foreground_color = l_foreground_color
self.background_color = l_background_color
self.effect = l_effect
Parameters
l_name
The name of the log level. This is shown in the log string.
- Type: str
l_foreground_color
The foreground color of the log level. This will be the log string foreground color.
- Type: ForegroundColor | str
- Default: ForegroundColor.white
l_background_color
The background color of the log level. This will be the log string background color.
- Type: BackgroundColor | str
- Default: """
l_effect
The effect of the log level. This will be the effect applied to the log string.
- Type: Effect | str
- Default: """
Example
from logpy.log import Level
custom_level = Level(
"LEVEL NAME",
ForegroundColor.red,
BackgroundColor.white,
Effect.reverse
)
Class: Levels
A collection of default (and the most used) log levels.
Attribute: normal
Normal log level.
Source
normal = Level("NORMAL", ForegroundColor.white)
Example
from logpy.log import Levels
Levels.normal
Attribute: notification
Notification log level.
Source
notification = Level("NOTIFICATION", ForegroundColor.blue)
Example
from logpy.log import Levels
Levels.notification
Attribute: alert
Alert log level.
Source
alert = Level("ALERT", ForegroundColor.yellow)
Example
from logpy.log import Levels
Levels.alert
Attribute: warning
Warning log level.
Source
warning = Level("WARNING", ForegroundColor.orange)
Example
from logpy.log import Levels
Levels.warning
Attribute: error
Error log level.
Source
error = Level("ERROR", ForegroundColor.red)
Example
from logpy.log import Levels
Levels.error
Attribute: success
Success log level.
Source
success = Level("SUCCESS", ForegroundColor.green)
Example
from logpy.log import Levels
Levels.success
Attribute: unknown
Unknown log level.
Source
unknown = Level("UNKNOWN", ForegroundColor.cyan)
Example
from logpy.log import Levels
Levels.unknown