private BMyLog4PB NewLog()
            {
                if (App == null || GlobalArgs == null)
                {
                    return(null);
                }

                BMyLog4PB TempLogger;
                string    verbosity = GlobalArgs.getOption("LogLevel")[0]?.Trim() ?? "error";

                if (verbosity.Equals("OFF"))
                {
                    TempLogger = null;
                }
                else
                {
                    TempLogger = new BMyLog4PB(this.App);
                    switch (verbosity)
                    {
                    case "trace":
                        TempLogger.Filter = BMyLog4PB.E_TRACE | BMyLog4PB.E_DEBUG | BMyLog4PB.E_INFO | BMyLog4PB.E_WARN | BMyLog4PB.E_ERROR | BMyLog4PB.E_FATAL;
                        break;

                    case "debug":
                        TempLogger.Filter = BMyLog4PB.E_DEBUG | BMyLog4PB.E_INFO | BMyLog4PB.E_WARN | BMyLog4PB.E_ERROR | BMyLog4PB.E_FATAL;
                        break;

                    case "info":
                        TempLogger.Filter = BMyLog4PB.E_INFO | BMyLog4PB.E_WARN | BMyLog4PB.E_ERROR | BMyLog4PB.E_FATAL;
                        break;

                    case "warn":
                        TempLogger.Filter = BMyLog4PB.E_WARN | BMyLog4PB.E_ERROR | BMyLog4PB.E_FATAL;
                        break;

                    case "error":
                        TempLogger.Filter = BMyLog4PB.E_ERROR | BMyLog4PB.E_FATAL;
                        break;

                    case "fatal":
                        TempLogger.Filter = BMyLog4PB.E_FATAL;
                        break;

                    default:
                        TempLogger.Filter = BMyLog4PB.E_ERROR | BMyLog4PB.E_FATAL;
                        break;
                    }
                    foreach (KeyValuePair <string, string> logMsg in LogMessages)
                    {
                        TempLogger.SetMessage(logMsg.Key, logMsg.Value);
                    }

                    TempLogger.AutoFlush = true;
                    TempLogger.AddAppender(new BMyLog4PB.BMyTextPanelAppender(GlobalArgs.getOption("LogLCD")[0]?.Trim() ?? "[BCC-LOG]", App));
                    TempLogger.Info("L1");
                }
                return(TempLogger);
            }
Пример #2
0
        /*
         * This this script does nothing by it's own.
         * This is a placeholder to keep trak of BMyLog4PB.
         *
         *
         * Please go to http://forums.keenswh.com/threads/log4pb-logging-debugging-lib.7389240/
         * for more information.
         */
        public void Main(string argument)
        {
            //initialize the logger (logging all kinds of messages to PB's CustomData)
            BMyLog4PB Log = new BMyLog4PB(this, BMyLog4PB.E_ALL, new BMyLog4PB.BMyCustomDataAppender(this));

            Log.Info("This message will appera in this PBs CustomData.");

            // output all the log messages
            Log.Flush();
        }