Example #1
0
 private void OnLogMessageArise(ILogMessage logMessage)
 {
     _logMessages.Add(logMessage);
     if (IsLoggingToFileEnabled)
     {
         var logger = LogManager.GetLogger(logMessage.MessageSubject);
         logger.Info(logMessage.ToString);
     }
     NewMessageAction?.Invoke(logMessage);
 }
Example #2
0
        public void LogMessage(string messageKey, LogMessageTypeEnum messageType = LogMessageTypeEnum.Info)
        {
            ILogMessage logMessage = _logMessageGettingFunc();

            logMessage.LogMessageType = messageType;
            logMessage.MessageSubject = _localizerService.GetLocalizedString(ApplicationGlobalNames.GENERAL);
            string localizedString = String.Empty;

            if (!_localizerService.TryGetLocalizedString(messageKey, out localizedString))
            {
                localizedString = messageKey;
            }
            logMessage.Description     = localizedString;
            logMessage.MessageDateTime = DateTime.Now;
            NewMessageAction?.Invoke(logMessage);
        }