private void ApplySimpleLogSetting(ISimpleLogSettings sl) { if (sl.LogType == LogType.None) { return; } FileStream fs = new FileStream(sl.LogPath, sl.LogAppend ? FileMode.Append : FileMode.Create, FileAccess.Write, FileShare.Read); ISimpleLogSettings loginfo = (ISimpleLogSettings)sl.Clone(); switch (sl.LogType) { case LogType.Binary: AddBinaryLogger(new BinaryLogger(loginfo, fs)); break; case LogType.Default: case LogType.PlainTextWithTimestamp: bool withTimestamp = (sl.LogType == LogType.PlainTextWithTimestamp); AddTextLogger(new DefaultLogger(loginfo, new StreamWriter(fs, Encoding.Default), withTimestamp)); break; case LogType.Xml: AddXmlLogger(new XmlLogger(loginfo, new StreamWriter(fs, Encoding.Default))); break; } }
private void ApplySimpleLogSetting(ISimpleLogSettings sl) { if (sl.LogType == LogType.None) { return; } FileStream fs = new FileStream(sl.LogPath, sl.LogAppend? FileMode.Append : FileMode.Create, FileAccess.Write); ISimpleLogSettings loginfo = (ISimpleLogSettings)sl.Clone(); switch (sl.LogType) { case LogType.Binary: _binaryLoggers.Add(new BinaryLogger(loginfo, fs)); break; case LogType.Default: _textLoggers.Add(new DefaultLogger(loginfo, new StreamWriter(fs, Encoding.Default))); break; case LogType.Xml: _xmlLoggers.Add(new XmlLogger(loginfo, new StreamWriter(fs, Encoding.Default))); break; } }