Exemple #1
0
        public void Log(LogReceivedEventArgs logReceivedEvent)
        {
            IFileConfig currentConfig = _fileConfigContainer.Get(logReceivedEvent.LogInfo.LogEvent);

            if (currentConfig == null)
            {
                throw new ConfigurationErrorsException($"{System.Enum.GetName(typeof(LogEvent), logReceivedEvent.LogInfo.LogEvent)} is not supported");
            }

            _fileAnalyzer.FileName      = currentConfig.FileName;
            _fileAnalyzer.LogPath       = currentConfig.LogPath;
            _fileAnalyzer.FileSizeLimit = currentConfig.FileSizeLimit;

            string logFile = _fileAnalyzer.GetLogFile();

            string message = _logMessageCreator.CreateMessage(logReceivedEvent.LogInfo);

            File.AppendAllText(logFile, message + System.Environment.NewLine);
        }
Exemple #2
0
        public void Log(LogReceivedEventArgs logReceivedEvent)
        {
            string message = _logMessageCreator.CreateMessage(logReceivedEvent.LogInfo);

            Console.WriteLine(message);
        }