OrigoDb components produce detailed log information. The core library includes a ConsoleLogger
which is used by default. You can adjust the amount of detail or disable logging altogether by assigning ConsoleLogger.MinimumLevel
with one of the LogLevel
enumeration values: Trace, Debug, Info, Warn, Error, Fatal, Off
. The default level is LogLevel.Info
If you need more sophisticated logging, OrigoDb can be extended to integrate with just about any logging framework. You can implement your own custom module or choose an existing one:
OrigoDb.Modules.BlackBox
.ILoggerFactory
with the LogProvider
classusing code like this:
LogProvider.SetFactory(new BlackboxLoggerFactory());
Create a custom logging module by implementing ILoggerFactory
. Consider deriving from OrigoDb.Core.Logging.Logger
which can spare you a lot of grunt work, there is only one method that needs to be implemented:
protected abstract void Write(LogLevel level, Func<string> messageGenerator);
The ILoggerFactory
has these members:
ILogger GetLoggerForCallingType();
ILogger GetLogger(Type type);
Origo components call the GetLoggerForCurrentType()
which should return the full name of the type including the namespace. Most log frameworks can filter and dispatch to different targets based on the name of the logger.
Have a look at the existing modules to learn more.