The log files are generated in the following format: UnityCloud_YYYY-MM-DD_HH-MM-SS.log
. A new log file is generated for each session, which starts when you call unity_cloud.initialize()
.
Find the logs
By default Python SDK logs are saved in a UnityCloud
folder. To find Python SDK logs, go to AppData > UnityCloud
.
Set a custom logging folder path
You can change the location where Python SDK logs are saved. To set a custom logging folder path, follow these steps:
- Locate the folder to use and store that path as a string.
- Use the
unity_cloud.set_logger_path
method to edit the location of the folder as a string.
unity_cloud.set_logger_path( path = "path/to/folder" ) unity_cloud.initialize()
For each session started by calling unity_cloud.initialize()
a new log file is generated in the most recently set folder path. If the folder does not exist, the folder will be created for the logs. The method accepts both absolute and relative paths.
Add a log entry
To add a log entry to the log file, follow these steps:
- Use the
unity_cloud.logger.log
method and set the log message as a string. - Edit the log message level which defaults to an
info
log level. - (Optional) Include a custom source for the message. The default value is
Unity Cloud Python SDK
.
unity_cloud.initialize() unity_cloud.logger.log( message = "Test log message", level = unity_cloud.logger.log_level.info, source = "custom_source" )