public Logger(bool toSTDOUT = true, T minLogLevel = default, ILogMessageFormater <T> messageFormater = null, params string[] logFilePath) { ILogMessageFormater <T> formater = messageFormater ?? DefaultLogMessageFormater <T> .Instance; TextWriter[] logFiles = new TextWriter[logFilePath.Length + (toSTDOUT ? 1 : 0)]; for (int i = 0; i < logFilePath.Length; i++) { logFiles[i] = new StreamWriter(logFilePath[i], true); } if (toSTDOUT) { logFiles[logFilePath.Length] = Console.Out; } fileHandler = new LogfileHandler <T>(formater, logFiles); startTime = Now; MinLogLevel = minLogLevel; T[] enumTypes = (T[])Enum.GetValues(typeof(T)); logEvents = new Dictionary <T, Action <LogMessage <T> > >(enumTypes.Length); foreach (var item in enumTypes) { logEvents.Add(item, default); } }
public Logger(T minLogLevel = default, ILogMessageFormater <T> messageFormater = null, params TextWriter[] pWriterStreams) { ILogMessageFormater <T> formater = messageFormater ?? DefaultLogMessageFormater <T> .Instance; fileHandler = new LogfileHandler <T>(formater, pWriterStreams); startTime = Now; MinLogLevel = minLogLevel; T[] enumTypes = (T[])Enum.GetValues(typeof(T)); logEvents = new Dictionary <T, Action <LogMessage <T> > >(enumTypes.Length); foreach (var item in enumTypes) { logEvents.Add(item, default); } }