Exemplo n.º 1
0
        public static void PrnError(string msg)
        {
            if ((CoCServerMain.CheckOpt) && (!CoCServerMain.PrnLogFilter(msg)))
            {
                return;
            }
            if (CoCServerMain.Opt.LOGDebug.bval)
            {
                if (stRuntime.isRunTime())
                {
                    stConsole.WriteHeader(Environment.StackTrace.ToString());
                }
                else
                {
#if DEBUG_StackTrace
                    stConsole.WriteHeader(Environment.StackTrace.ToString());
#endif
                    StackFrame CallStack = null;
                    for (int i = 1; i < 10; i++)
                    {
                        CallStack = new StackFrame(i, true);
                        if ((CallStack != null) && (!string.IsNullOrWhiteSpace(CallStack.GetFileName())))
                        {
                            msg += string.Format(
                                "{0}{1}[{2}:{3}]",
                                Environment.NewLine,
                                stConsole.GetTabString(2, i),
                                Path.GetFileName(CallStack.GetFileName()),
                                CallStack.GetFileLineNumber()
                                );
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            stConsole.MessageError(
                Properties.Resources.PrnError, msg,
                ((!CoCServerMain.CheckOpt) ? true :
                 ((!CoCServerMain.Opt.PrnQuiet.bval) ? true : false))
                );
            if ((CoCServerMain.CheckOpt) && (CoCServerMain.Opt.LOGRemoteServerEnable.bval))
            {
                CoCServerMain.LogToSyslog(msg, stNet.Syslog.Level.Error, stNet.Syslog.Facility.Local5);
            }
        }
Exemplo n.º 2
0
 public static void PrnInfo(string msg)
 {
     if ((CoCServerMain.CheckOpt) && (!CoCServerMain.PrnLogFilter(msg)))
     {
         return;
     }
     stConsole.MessageInfo(
         Properties.Resources.PrnOK, msg,
         ((!CoCServerMain.CheckOpt) ? true :
          ((!CoCServerMain.Opt.PrnQuiet.bval) ? true : false))
         );
     if ((CoCServerMain.CheckOpt) && (CoCServerMain.Opt.LOGRemoteServerEnable.bval))
     {
         CoCServerMain.LogToSyslog(msg, stNet.Syslog.Level.Information, stNet.Syslog.Facility.Local5);
     }
 }