Table of Contents

Class LoggingExtensions

Namespace
Cognite.Simulator.Utils
Assembly
Cognite.Simulator.Utils.dll

Extension utilities for logging

public static class LoggingExtensions
Inheritance
LoggingExtensions
Inherited Members

Methods

AddLogger(IServiceCollection, bool)

Adds a configured Serilog logger as singleton of the ILogger and Serilog.ILogger types to the services collection. This is a Simulator specific logger as it writes logs to the remote sink (Simulators Logs resource in CDF). A configuration object of type LoggerConfig is required, and should have been added to the collection as well.

This defaults to GetConfiguredLogger(LoggerConfig, ILogEventSink) which creates logging configuration for file and console using LoggingUtils.GetConfiguration(LoggerConfig)

public static void AddLogger(this IServiceCollection services, bool alternativeLogger = false)

Parameters

services IServiceCollection

The service collection

alternativeLogger bool

True to allow alternative loggers, i.e. allow config.Console and config.File to be null