Пример #1
0
        public static void InfoEx(this ILog log, string methodName, string clientRemoteAddress, TimeSpan tonalityElapsed, InputParamsBase inputParams)
        {
            var value = Interlocked.Increment(ref _TotalLogCount) + "]. " +
                        methodName + " => \r\n\t ClientRemoteAddress: " + clientRemoteAddress +
                        "\r\n\t Tonality processing time: " + tonalityElapsed +
                        "\r\n\t Input text (length: {0}): ".FormatEx(inputParams.InputText.Length) +
                        inputParams.InputText.Get4Log();

            log.Info(value);

        #if DEBUG
            lock ( _SynRoot )
            {
                var fc = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine(Environment.NewLine + value);
                Console.ForegroundColor = fc;
                Console.WriteLine(RuleBase.GetDebugInfoOutput());
            }
        #endif
        }
Пример #2
0
        public static void ErrorEx(this ILog log, string methodName, Exception ex, string clientRemoteAddress, InputParamsBase inputParams, XContainer xcontainer)
        {
            var value = ("{0}]. ").FormatEx(Interlocked.Increment(ref _TotalLogCount)) +
                        ("{0} => '{1}': '{2}'").FormatEx(methodName, ex.GetType().Name, ex.Message) +
                        ("\r\n\t ClientRemoteAddress: {0}").FormatEx(clientRemoteAddress) +
                        ("\r\n\t Input text (length: {0}): ").FormatEx(inputParams.InputText.Length) +
                        inputParams.InputText.InSingleQuote() +
                        ((xcontainer != null) ? ("\r\n\t XML: [\r\n{0}\r\n]").FormatEx(xcontainer.ToString()) : string.Empty);

            log.Error(value, ex);

        #if DEBUG
            lock ( _SynRoot )
            {
                var fc = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(Environment.NewLine + value + Environment.NewLine + Environment.NewLine + ex.GetType().Name + " => " + ex.ToString());
                Console.ForegroundColor = fc;
                Console.WriteLine(RuleBase.GetDebugInfoOutput());
            }
        #endif
        }