spy_log Module
The Spyral logging system.
get_spyral_logger(module)
Get the spyral logger for this process,
The logger is decorated with the module name from which it is being called, allowing for easier tracing of errors.
Do not call this directly, prefer one of the spyral_* log functions
Parameters:
Name | Type | Description | Default |
---|---|---|---|
module |
str
|
The module name from which the logger is called |
required |
Returns:
Type | Description |
---|---|
Logger
|
The Logger |
Source code in src/spyral/core/spy_log.py
init_spyral_logger_child(workspace_path, process_id)
Setup the spyral logging system for a child process.
Should only be called once at the start of each child process.
This will create a log file in the log/ directory of the workspace, where the name indicates which child process is logging to it. All stdout messages are then written to this log file. Each process gets its own log to avoid any need for synchronization.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workspace_path |
Path
|
The project workspace path |
required |
process_id |
int
|
The process id used to name the log file |
required |
Source code in src/spyral/core/spy_log.py
init_spyral_logger_parent(workspace_path)
Setup the Spyral logger for the parent process
Should only be used by the parent process
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workspace_path |
Path
|
The project workspace path |
required |
Source code in src/spyral/core/spy_log.py
spyral_debug(module, message)
Log a debug message
Use like
The magic__name__
variable will be the module name
Parameters:
Name | Type | Description | Default |
---|---|---|---|
module |
str
|
The module from which the logger was called |
required |
message |
str
|
The log message |
required |
Source code in src/spyral/core/spy_log.py
spyral_error(module, message)
Log an error
Use like
The magic__name__
variable will be the module name
Parameters:
Name | Type | Description | Default |
---|---|---|---|
module |
str
|
The module from which the logger was called |
required |
message |
str
|
The log message |
required |
Source code in src/spyral/core/spy_log.py
spyral_except(module, exception)
Log an exception
Use like
The magic__name__
variable will be the module name
Parameters:
Name | Type | Description | Default |
---|---|---|---|
module |
str
|
The module from which the logger was called |
required |
exception |
Exception
|
The exception to be logged |
required |
Source code in src/spyral/core/spy_log.py
spyral_info(module, message)
Log some info
Use like
The magic__name__
variable will be the module name
Parameters:
Name | Type | Description | Default |
---|---|---|---|
module |
str
|
The module from which the logger was called |
required |
message |
str
|
The log message |
required |
Source code in src/spyral/core/spy_log.py
spyral_warn(module, message)
Log a warning
Use like
The magic__name__
variable will be the module name
Parameters:
Name | Type | Description | Default |
---|---|---|---|
module |
str
|
The module from which the logger was called |
required |
message |
str
|
The log message |
required |