Example #1
0
        /// <summary>
        ///     The add entry.
        /// </summary>
        /// <param name="type">
        ///     The type.
        /// </param>
        /// <param name="message">
        ///     The message.
        /// </param>
        /// <param name="args">
        ///     The args.
        /// </param>
        internal static void AddEntry(LoggingEntryTrype type, string message, params object[] args)
        {
            switch (type)
            {
            case LoggingEntryTrype.Debug:
                AddEntryColored(GetFormattedEntry(type, message, args), ConsoleColor.Green);
                break;

            case LoggingEntryTrype.Error:
                AddEntryColored(GetFormattedEntry(type, message, args), ConsoleColor.DarkRed);
                break;

            case LoggingEntryTrype.Generic:
                AddEntryColored(GetFormattedEntry(type, message, args), ConsoleColor.White);
                break;

            case LoggingEntryTrype.Info:
                AddEntryColored(GetFormattedEntry(type, message, args), ConsoleColor.Yellow);
                break;

            case LoggingEntryTrype.Warning:
                AddEntryColored(GetFormattedEntry(type, message, args), ConsoleColor.Red);
                break;
            }
        }
Example #2
0
        /// <summary>
        ///     The add entry.
        /// </summary>
        /// <param name="type">
        ///     The type.
        /// </param>
        /// <param name="message">
        ///     The message.
        /// </param>
        /// <param name="args">
        ///     The args.
        /// </param>
        internal static void AddEntry(LoggingEntryTrype type, string message, params object[] args)
        {
            switch (type)
            {
                case LoggingEntryTrype.Debug:
                    AddEntryColored(GetFormattedEntry(type, message, args), ConsoleColor.Green);
                    break;

                case LoggingEntryTrype.Error:
                    AddEntryColored(GetFormattedEntry(type, message, args), ConsoleColor.DarkRed);
                    break;

                case LoggingEntryTrype.Generic:
                    AddEntryColored(GetFormattedEntry(type, message, args), ConsoleColor.White);
                    break;

                case LoggingEntryTrype.Info:
                    AddEntryColored(GetFormattedEntry(type, message, args), ConsoleColor.Yellow);
                    break;

                case LoggingEntryTrype.Warning:
                    AddEntryColored(GetFormattedEntry(type, message, args), ConsoleColor.Red);
                    break;
            }
        }
Example #3
0
 /// <summary>
 ///     Formats a given <see cref="string" /> and adds specific prefixes
 /// </summary>
 /// <param name="type">
 ///     The type.
 /// </param>
 /// <param name="message">
 ///     The message.
 /// </param>
 /// <param name="args">
 ///     The args.
 /// </param>
 /// <returns>
 ///     <see cref="string" />
 /// </returns>
 private static string GetFormattedEntry(LoggingEntryTrype type, string message, params object[] args)
 {
     try
     {
         // ReSharper disable once UseStringInterpolation
         return(string.Format(
                    "[ElNamiDecentralized {0}] ({1}): {2}",
                    DateTime.Now.ToString("HH:mm:ss"),
                    type,
                    string.Format(ReplaceStrings(message), args)));
     }
     catch (Exception e)
     {
         Console.WriteLine("@Logging.cs: Can not format string - {0}", e);
         throw;
     }
 }
Example #4
0
 /// <summary>
 ///     Formats a given <see cref="string" /> and adds specific prefixes
 /// </summary>
 /// <param name="type">
 ///     The type.
 /// </param>
 /// <param name="message">
 ///     The message.
 /// </param>
 /// <param name="args">
 ///     The args.
 /// </param>
 /// <returns>
 ///     <see cref="string" />
 /// </returns>
 private static string GetFormattedEntry(LoggingEntryTrype type, string message, params object[] args)
 {
     try
     {
         // ReSharper disable once UseStringInterpolation
         return string.Format(
             "[AniviaSharp {0}] ({1}): {2}",
             DateTime.Now.ToString("HH:mm:ss"),
             type,
             string.Format(ReplaceStrings(message), args));
     }
     catch (Exception e)
     {
         Console.WriteLine("@Logging.cs: Can not format string - {0}", e);
         throw;
     }
 }