private void WriteLogIfLogElementIsEnabled(Log log, LogElement logElement) { if (logElement.IsEnabled()) { LogWriter.WriteLog(log, logElement); } }
private void WriteLogToFile(Log log, LogElement logElement) { StreamWriter fileDescriptor = File.AppendText(logElement.FilePath); string logLine = CreateLogLine(log); fileDescriptor.WriteLine(logLine); fileDescriptor.Close(); }
/** * @see FileWriter */ public void WriteLog(Log log, LogElement logElement) { if (EventLogSourceDoesNotExist()) { CreateEventLogSourceForLevel(log.Level); } WriteLogToEventLog(log); }
private void LoadLogElementIntoLogLevelFiles(LogElement log) { ArrayList logs; if (!LogLevelFiles.TryGetValue(log.Level, out logs)) { logs = new ArrayList(); LogLevelFiles.Add(log.Level, logs); } logs.Add(log); }
/** * @see FileWriter */ public void WriteLog(Log log, LogElement logElement) { try { if (!File.Exists(logElement.FilePath)) { File.Create(logElement.FilePath); } WriteLogToFile(log, logElement); } catch (IOException) { throw new WritingException(logElement.FilePath); } }