예제 #1
0
 private void onLogReceived(object sender, Logger.MessageArgs e)
 {
     if (Log._.isError(e.Level))
     {
         errorList.error(e.Message);
     }
     else if (Log._.isWarn(e.Level))
     {
         errorList.warn(e.Message);
     }
 }
예제 #2
0
        /// <summary>
        /// Works with all processes of internal logging.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void onLogging(object sender, MessageArgs e)
        {
            if(SlnEvents == null) {
                return; // can be early initialization
            }

            if(Thread.CurrentThread.Name == Events.LoggingEvent.IDENT_TH) {
                return; // self protection
            }

            if(isDisabledAll(SlnEvents.Logging)) {
                return;
            }

            if(!IsAllowActions) {
                _ignoredAction(SolutionEventType.Logging);
                return;
            }

            (new Task(() => {

                Thread.CurrentThread.Name = Events.LoggingEvent.IDENT_TH;
                lock(_lock)
                {
                    IComponent component = cmd.SBEScript.Bootloader.getComponentByType(typeof(OWPComponent));
                    if(component != null) {
                        ((ILogData)component).updateLogData(e.Message, e.Level);
                    }

                    foreach(LoggingEvent evt in SlnEvents.Logging)
                    {
                        if(!isExecute(evt, current)) {
                            Log.Info("[Logging] ignored action '{0}' :: by execution order", evt.Caption);
                            continue;
                        }

                        try {
                            if(cmd.exec(evt, SolutionEventType.Logging)) {
                                Log.Trace("[Logging]: " + evt.Caption);
                            }
                        }
                        catch(Exception ex) {
                            Log.Error("LoggingEvent error: {0}", ex.Message);
                        }
                    }
                }

            })).Start();
        }