Class Logger
Last updated
Last updated
This logger type is meant to be used independently of Unity, mostly for non-MonoBehaviour classes.
Configuring a ClassLogger is done exclusively through code, but still makes use of the .
To instantiate it, create a new field in the desired script:
There are two ways to assign a logger settings instance to a new class logger, by loading an existing instance or by creating it altogether.
To use an existing LoggerSettings, that has been created and is saved in the Resources folder: 'Resources/Logging/ExampleLoggerSettings.asset', making use of the Resources class from Unity can fetch and load the ScriptableObject:
It's possible to create an instance of the Logger Settings and configure it programatically. This removes the dependency from the scriptable object asset file, but it introduces a startup performance overhead and removes the advantages of using the Unity Editor to configure the LoggerSettings.
Make use of the static CreateInstace method from the ScriptableObject class to create a new instance of the LoggerSettings:
Now the variable loggerSettings exists and call be fully configured in the script: