Пример #1
0
 internal static void WriteLineIf(bool condition, string str, LogTag logTag)
 {
     if (condition)
     {
         WriteLine(str, logTag, LogTag.NewLine);
     }
 }
Пример #2
0
        internal static void WriteLine(string str, LogTag logTag, string newLineReplacement)
        {
            if (str != null)
            {
                str = str.Replace("\\r\\n", Environment.NewLine);

                if (ToolConsole.Verbosity > Verbosity.Minimal || logTag == LogTag.Error || logTag == LogTag.Important ||
                    (ToolConsole.Verbosity == Verbosity.Minimal && logTag == LogTag.Warning) || LogTag.IsTrace(logTag))
                {
                    if (IsMarkupEnabled)
                    {
                        str = logTag + str.Replace(Environment.NewLine, newLineReplacement);
                    }

                    Console.WriteLine(str);
                }
            }
        }
Пример #3
0
        private void LogMessage(string message, LogTag logTag, bool logToUI = false)
        {
            if (this.EnableTracing || logToUI)
            {
                message = message?.Trim();

                if (!string.IsNullOrEmpty(message))
                {
                    if (logTag == LogTag.Error)
                    {
                        ToolConsole.WriteError(message, isTrace: !logToUI);
                    }
                    else if (logTag == LogTag.Warning)
                    {
                        ToolConsole.WriteWarning(message, isTrace: !logToUI);
                    }
                    else
                    {
                        ToolConsole.WriteLine(message, logToUI ? LogTag.Information : LogTag.LogMessage);
                    }
                }
            }
        }
Пример #4
0
 internal static void WriteLine(string str, LogTag logTag)
 {
     WriteLine(str, logTag, LogTag.NewLine);
 }
Пример #5
0
 public static bool IsTrace(LogTag tag)
 {
     return(tag == LogTag.TraceSuccess || tag == LogTag.TraceProperty || tag == LogTag.TraceFailure || tag == LogTag.TraceException || tag == LogTag.LogMessage);
 }