public static void ErrorEx(this ILog log, string methodName, Exception ex, string clientRemoteAddress, InputParamsBase inputParams, XDocument xdocument) { 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() + ((xdocument != null) ? ("\r\n\t XML: [\r\n{0}\r\n]").FormatEx(xdocument.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 }
public static void InfoEx(this ILog log, string methodName, string clientRemoteAddress, TimeSpan linguisticElapsed, TimeSpan opinionMiningElapsed, InputParamsBase inputParams) { var value = Interlocked.Increment(ref _TotalLogCount) + "]. " + methodName + " => \r\n\t ClientRemoteAddress: " + clientRemoteAddress + "\r\n\t Linguistic processing time: " + linguisticElapsed + "\r\n\t Opinion-mining processing time: " + opinionMiningElapsed + "\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 }