public UnityLoggerFactoryV2([Zenject.InjectOptional] GameObject gameobject, IStructuredLogEventWriter writer) { this.gameobject = gameobject; this.writer = writer; this.config = this.GetConfig(gameobject); Assert.IsNotNull(this.config); }
private Logging GetConfig(GameObject gameobject) { // Get the Logging config from own gameobject or any parent. Logging config = null; if (gameobject != null) { config = gameobject.GetComponentInParent <Logging>(); } if (config == null) { if (rootLogConfig == null) { var rootConfigGo = GameObject.Find("Logging"); if (rootConfigGo == null) { rootConfigGo = new GameObject("Logging"); } config = rootConfigGo.GetComponent <Logging>(); if (config == null) { config = rootConfigGo.AddComponent <Logging>(); } rootLogConfig = config; } else { config = rootLogConfig; } } return(config); }
public UnityLogger(ILogSource source, ILogLevelConfig config) : base(source, new LogLevelStatus(config)) { }