-
Notifications
You must be signed in to change notification settings - Fork 118
Logging
Ondrej Medek edited this page Sep 21, 2017
·
2 revisions
The library use own ILog
interface for logging. Configure LogManager.LoggerFunc()
for the custom logging. Set it to NullLog.Instance
to disable the logging completely. Subclass DebugTraceLog
to customise the System.Diagnostics.Trace
or take it as an example to create own logging proxy class.
Example class for log4net logging:
/// <summary>
/// Logger proxy log4net to WpfMediaKit.
/// </summary>
public class WpfMediaKitLogger : WPFMediaKit.ILog
{
private ILog _log;
public WpfMediaKitLogger(string name)
{
_log = cvtLogger.GetLogger(name);
}
public bool IsInfoEnabled
=> _log.IsInfoEnabled;
public bool IsDebugEnabled
=> _log.IsInfoEnabled;
public void Error(Exception exception, string message, params object[] args)
{
if (!_log.IsErrorEnabled)
return;
if (exception == null)
_log.ErrorFormat(message, args);
else
_log.Error(string.Format(message, args), exception);
}
public void Warn(string message, params object[] args)
{
_log.WarnFormat(message, args);
}
public void Debug(string message, params object[] args)
{
_log.DebugFormat(message, args);
}
public void Info(string message, params object[] args)
{
_log.InfoFormat(message, args);
}