Exemplo n.º 1
0
 /// <summary>
 /// Registers a logger to be used by the remote engine
 /// </summary>
 /// <returns>The logger id.</returns>
 /// <remarks>Project builders register a logger and provide the logger id
 /// to the remote project builders. The remote process sends log messages
 /// that include the logger id, and this class redirects the log to
 /// one of the registered loggers.</remarks>
 public int RegisterLogger(TextWriter writer, MSBuildLogger logger)
 {
     lock (loggers) {
         var i = loggerIdCounter++;
         loggers [i] = new LoggerInfo {
             Writer = writer, Logger = logger
         };
         return(i);
     }
 }
Exemplo n.º 2
0
        void OnLogMessage(LogMessage msg)
        {
            LoggerInfo logger = null;

            lock (loggers) {
                if (!loggers.TryGetValue(msg.LoggerId, out logger))
                {
                    return;
                }
            }
            if (msg.LogText != null)
            {
                logger.Writer.Write(msg.LogText);
            }
            if (msg.Events != null && logger.Logger != null)
            {
                foreach (var e in msg.Events)
                {
                    logger.Logger.NotifyEvent(e);
                }
            }
        }