- Apple
- Android
The new runtime supports logging via the Once you have implemented your own logger, you can set it to the
RiveLog type. To enable logging, set the RiveLog.logger property to a RiveLog.Logger implementation. The new runtime defaults to no logging, which can be set at any time by setting RiveLog.logger to RiveLog.none. The new runtime ships with a default implementation that logs to the console, which can be set by using the RiveLog.system(levels:) helper function. When using the system logger, any logs that are not emitted at the levels specified will be suppressed.Levels
Logs will be logged at various levels, which are inspired byOSLogType . These levels can be used to additionally filter logs to be logged at certain levels only. Available levels are:- Notice: important informational logs
- Debug: commonly used to aid with debugging
- Trace: highly detailed and potentially verbose diagnostic logs, including operations like advancing that may emit at least one log per frame
- Info: logs that provide additional information
- Error: used when an error occurs
- Warning: used when a potential issue is detected
- Fault: used when a severe error occurs
- Critical: used when a fatal error occurs
- .default:
.debug,.warning,.error,.fault,.critical - .all: all levels (
.notice,.debug,.trace,.info,.error,.warning,.fault,.critical)
Custom Logger
You can also implement your own custom logger by implementing theRiveLog.Logger protocol. This allows you to log to any desired sink, such as a file, a network endpoint, or a custom console.RiveLog.logger property.