Esempio n. 1
0
        void Log_MessageLogged(object sender, MessageLoggedEventArgs e)
        {
            var message = e.Message;

            var serializableMessage = message as SerializableLogMessage;
            if (serializableMessage == null)
            {
                var logMessage = message as LogMessage;
                if (logMessage != null)
                {
                    // Ignore MicroThreadCancelledException (they are supposed to be intentionally triggered by live scripting reloading)
                    if (logMessage.Exception is MicroThreadCancelledException)
                        return;

                    serializableMessage = new SerializableLogMessage(logMessage);
                }
            }

            if (serializableMessage == null)
            {
                throw new InvalidOperationException(@"Unable to process the given log message.");
            }

            host.OnLogMessage(serializableMessage);
        }
Esempio n. 2
0
 /// <summary>
 /// The callback of the <see cref="Logger.MessageLogged"/> event, used to monitor incoming messages.
 /// </summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="args">The event argument.</param>
 private void MessageLogged(object sender, MessageLoggedEventArgs args)
 {
     lock (pendingMessages)
     {
         pendingMessages.Add(Tuple.Create((Logger)sender, args.Message));
         if (!updatePending)
         {
             updatePending = true;
             Dispatcher.BeginInvoke(UpdateMessages);
         }
     }
 }
Esempio n. 3
0
        void Log_MessageLogged(object sender, MessageLoggedEventArgs e)
        {
            var message = e.Message;

            var serializableMessage = message as SerializableLogMessage;
            if (serializableMessage == null)
            {
                var logMessage = message as LogMessage;
                if (logMessage != null)
                {
                    serializableMessage = new SerializableLogMessage(logMessage);
                }
            }

            if (serializableMessage == null)
            {
                throw new InvalidOperationException(@"Unable to process the given log message.");
            }

            host.OnLogMessage(serializableMessage);
        }