Logger
Introduction¶
The RFLogger class of the rf_logger module set up a logger for your integration.
The logger is built-in in all the Managers classes in PSEngine, which means it is used by default as soon as any form of logging is enabled in your code.
This could be in three ways:
- If the SDK you are using have already a logging capability enabled
- If you have already enabled logging
- Neither point 1 and 2, and you want to use the PSEngine logger.
See the API Reference for internal details of the module.
Examples¶
Warning
Below are some examples of usage of the module. Consider adding error handling as necessary. All the errors that can be raised by each method or function are specified in the API Reference page.
Also, you need to configure the RF_TOKEN environment variable before starting. See Learn.
Example 1: Use a PSEngine module when another SDK has logging enabled.¶
In this example we are creating a Logger instance from the logging standard library to emulate the fact that you might have configured your own logging. In this case there is nothing else that needs to be done before using PSEngine.
If you set the the logging level to DEBUG you will see all the internal PSEngine debug logging.
Any log entries of higher level, like ERROR or CRITICAL will be shown as well.
Example 2: Use RFLogger in combination with another PSEngine module¶
In this example we have the same code, expect for the logger definition which is via RFLogger. The default RFLogger behaviours are:
- to log on console and on file under the
logs/directory in the same location where your script is running - to log everything from
INFOabove - formatted log entries:
- maintain the log propagation for other loggers
All of these parameters can be configured during RFLogger initialization.