예제 #1
0
        /// <summary>
        /// Logs the message.
        /// </summary>
        /// <param name="level">The logging level.</param>
        /// <param name="messageEntity">The message entity.</param>
        protected override void InternalLog(LogLevel level, LogMessageTableEntity messageEntity)
        {
            if (this._blobContainer != null)
            {
                try
                {
                    string logFile = $"{LogsRootFolder}/{messageEntity.Timestamp.ToString(YearFormat, CultureInfo.InvariantCulture)}/{messageEntity.Timestamp.ToString(MonthFormat, CultureInfo.InvariantCulture)}/{messageEntity.Timestamp.ToString(DayFormat, CultureInfo.InvariantCulture)}/{messageEntity.Timestamp.ToString(TimeFormat, CultureInfo.InvariantCulture)}.log";
                    this._blobContainer.AppendBlobAppendText(logFile, messageEntity.ToString() + Environment.NewLine);
                }
                catch (Exception e)
                {
                    var internalError = InternalLogger.Log(e);

                    try
                    {
                        string logFile = $"{LogsRootFolder}/internal/{messageEntity.Timestamp.ToString(TimeFormat, CultureInfo.InvariantCulture)}.log";
                        this._blobContainer.AppendBlobAppendText(logFile, internalError + Environment.NewLine);
                        this._blobContainer.AppendBlobAppendText(logFile, messageEntity.ToString() + Environment.NewLine);
                    }
                    catch (Exception ex)
                    {
                        InternalLogger.Log(ex);
                    }
                }
            }
            else
            {
                InternalLogger.Log("DevLib.Azure.Logging.BlobLogger._blobContainer is null");
            }
        }
예제 #2
0
        /// <summary>
        /// Logs the message.
        /// </summary>
        /// <param name="level">The logging level.</param>
        /// <param name="messageEntity">The message entity.</param>
        protected override void InternalLog(LogLevel level, LogMessageTableEntity messageEntity)
        {
            try
            {
                if (level == LogLevel.EXP || level == LogLevel.ERR || level == LogLevel.FAL)
                {
                    Debug.Fail(messageEntity.ToString());
                }

                Debug.WriteLine(messageEntity.ToString());
            }
            catch (Exception e)
            {
                InternalLogger.Log(e);
            }
        }
예제 #3
0
 /// <summary>
 /// Logs the message.
 /// </summary>
 /// <param name="level">The logging level.</param>
 /// <param name="messageEntity">The message entity.</param>
 protected override void InternalLog(LogLevel level, LogMessageTableEntity messageEntity)
 {
     try
     {
         if (level == LogLevel.ALL || level == LogLevel.DBG || level == LogLevel.INF)
         {
             Trace.TraceInformation(messageEntity.ToString());
         }
         else if (level == LogLevel.WRN)
         {
             Trace.TraceWarning(messageEntity.ToString());
         }
         else if (level == LogLevel.EXP || level == LogLevel.ERR)
         {
             Trace.TraceError(messageEntity.ToString());
         }
         else if (level == LogLevel.FAL)
         {
             Trace.TraceError(messageEntity.ToString());
             Trace.Fail(messageEntity.ToString());
         }
         else
         {
             Trace.WriteLine(messageEntity.ToString());
         }
     }
     catch (Exception e)
     {
         InternalLogger.Log(e);
     }
 }
예제 #4
0
 /// <summary>
 /// Logs the message.
 /// </summary>
 /// <param name="level">The logging level.</param>
 /// <param name="messageEntity">The message entity.</param>
 protected override void InternalLog(LogLevel level, LogMessageTableEntity messageEntity)
 {
     try
     {
         lock (ConsoleSyncRoot)
         {
             ConsoleColor originalForeColor = Console.ForegroundColor;
             Console.ForegroundColor = ConsoleColorDictionary[level];
             Console.WriteLine(messageEntity.ToString());
             Console.WriteLine();
             Console.ForegroundColor = originalForeColor;
         }
     }
     catch (Exception e)
     {
         InternalLogger.Log(e);
     }
 }