public void Ctor_DeclareLogObjectWithNullFormatter_ExceptionThrown() { ILogEntryFormatter entryFormatter = null; ILogOutput logOutput = new FileOutput(); Assert.Throws <ArgumentNullException>(() => new Log(logOutput, entryFormatter)); }
public TextWriterLogSink(Stream stream, ILogEntryFormatter formatter = null) : this(new StreamWriter(stream), formatter) { if (stream == null) { throw new ArgumentNullException("stream"); } }
/// <summary> /// /// </summary> /// <param name="config"></param> public override void Initialize(IConfigNode config) { base.Initialize(config); if (this.Formatter == null) { this.Formatter = new TextFormatter(); } }
public FileLogger( ILogEntryFormatter logEntryFormatter, ILoggerSettingsRepository loggerSettingsRepository ) { _logEntryFormatter = logEntryFormatter; _loggerSettingsRepository = loggerSettingsRepository; }
/// <summary> /// Internal to make it accessable to unittests. Don't use this constructor unless you know what you're doing! /// </summary> /// <param name="logOutput"></param> /// <param name="logFormatter"></param> internal Log(ILogOutput logOutput, ILogEntryFormatter logFormatter) { if (logOutput == null || logFormatter == null) { throw new ArgumentNullException("Log Output parameter or Formatter parameter is null."); } _logOutput = logOutput; _logFormatter = logFormatter; }
/// <summary> /// LogListener base class. /// </summary> /// <param name="id">Identifier of the listener.</param> /// <param name="name">Name of the listener.</param> /// <param name="filter">Filter applied to the incoming log entries.</param> /// <param name="formatter">Format used to convert log entry to string.</param> protected LogListener(string id, string name, ILogEntryFilter filter, ILogEntryFormatter formatter) { Id = id; Name = name; Filter = filter; Formatter = formatter; IsEnabled = true; }
/// <summary> /// Sets the formatter which can then be retrieved from the <seealso cref="CurrentFormatter"/> property. /// </summary> /// <param name="logEntryFormatter">The formatter instance to be set.</param> public static void SetFormatter(ILogEntryFormatter logEntryFormatter) { if (logEntryFormatter == null) { throw new ArgumentNullException("logEntryFormatter"); } _logEntryFormatter = logEntryFormatter; }
public TextWriterLogSink(TextWriter writer, ILogEntryFormatter formatter = null) { if (writer == null) throw new ArgumentNullException("writer"); Writer = writer; Lock = new ReaderWriterLockSlim(); Formatter = formatter ?? new LogEntryFormatter(); }
public RollingFileLogSink(IRollingFileSettings settings, IRollingFileManager logWriterManager = null, ILogEntryFormatter formatter = null, Verbosity verbosity = Verbosity.All) { if (settings == null) throw new ArgumentNullException("settings"); _settings = settings; _formatter = formatter ?? new LogEntryFormatter(); _logWriterManager = logWriterManager ?? new RollingFileManager(settings, new LogFolder(settings.BasePath, settings.BaseFileName)); _verbosity = verbosity; }
public TextWriterLogSink(TextWriter writer, ILogEntryFormatter formatter = null) { if (writer == null) { throw new ArgumentNullException("writer"); } Writer = writer; Lock = new ReaderWriterLockSlim(); Formatter = formatter ?? new LogEntryFormatter(); }
public FileLogger( ILogEntryFormatter logEntryFormatter, ILoggerSettingsRepository loggerSettingsRepository ) : base(logEntryFormatter) { Settings = loggerSettingsRepository.Get(); lock (lockObj) { using (var streamWriter = new StreamWriter(GetFilePath(), false)) { streamWriter.WriteLine(string.Empty); streamWriter.Close(); } } }
public StringLogSink(ILogEntryFormatter formatter = null) : base(new StringWriter(), formatter) { LastText = string.Empty; }
/// <summary> /// Internal to make it accessable to unittests. Don't use this constructor unless you know what you're doing! /// </summary> /// <param name="logOutput"></param> /// <param name="logFormatter"></param> internal Log(ILogOutput logOutput, ILogEntryFormatter logFormatter) { if (logOutput == null || logFormatter == null) throw new ArgumentNullException("Log Output parameter or Formatter parameter is null."); _logOutput = logOutput; _logFormatter = logFormatter; }
protected abstract ILogger CreateLogger(string name, ILogEntryFormatter formatter, LogLevel level);
public TextWriterLogSink(Stream stream, ILogEntryFormatter formatter = null) : this(new StreamWriter(stream), formatter) { if (stream == null) throw new ArgumentNullException("stream"); }
protected AbstractLogger(string name, ILogEntryFormatter formatter, LogLevel level) { _name = name; _formatter = formatter; LogLevel = level; }
protected AbstractLoggerFactory(ILogEntryFormatter formatter, LogLevel level) { _cachedLoggers = new Hashtable(); _formatter = formatter; LogLevel = level; }
public ConsoleLogger(ILogEntryFormatter logEntryFormatter) : base(logEntryFormatter) { }
public LPFMUTLogger(string name, ILogEntryFormatter formatter, LogLevel level) : base(name, formatter, level) { }
public LPFMUTLoggerFactory(ILogEntryFormatter formatter, LogLevel level) : base(formatter, level) { }
public TraceLogger(ILogEntryFormatter logEntryFormatter) : base(logEntryFormatter) { }
protected override ILogger CreateLogger(string name, ILogEntryFormatter formatter, LogLevel level) { return(new LPFMUTLogger(name, formatter, level)); }
public LoggerBase(ILogEntryFormatter logEntryFormatter) { _logEntryFormatter = logEntryFormatter; }
/// <summary> /// Returns a <see cref="String" /> that represents the default string /// representation of this entry. /// </summary> /// <returns> /// A <see cref="String" /> that represents the current /// <see cref="Object" /> . /// </returns> public override string ToString() { ILogEntryFormatter formatter = Formatter ?? DefaultFormatter.Instance; return(formatter.FormatEntry(this)); }