MuxLogger Class

Definition

Represents a multiplexing logger. The purpose of this logger is to register and unregister multiple loggers during the build. Supports the Visual Studio IDE scenario in which loggers are registered and unregistered for each project system's build request. One physical build can have multiple logical builds, each with its own set of loggers.

The MuxLogger registers itself with the build manager as a regular central /l style logger. It receives messages from the build manager and routes them to the correct logger, based on the logical build that the message came from.

public ref class MuxLogger : Microsoft::Build::Framework::INodeLogger
public class MuxLogger : Microsoft.Build.Framework.INodeLogger
type MuxLogger = class
    interface INodeLogger
    interface ILogger
Public Class MuxLogger
Implements INodeLogger
Inheritance
MuxLogger
Implements

Remarks

The MuxLogger generally functions as follows:

  • The MuxLogger is registered at the beginning of the build manager's Begin build.

    Any loggers registered before the build manager starts the build get the build-started event at the same time as the MuxLogger.

    Any loggers registered after the build manager starts the build get a synthesized build-started event. The event cannot be cached because the timestamp of the build-started event is determined when the event is created, and caching the event would give incorrect build times in the loggers registered to the MuxLogger.

  • The MuxLogger is initialized by the build manager

    The MuxLogger listens to all events on the event source from the build manager and routes events correctly to the registered loggers.

  • The MuxLogger is shutdown when the build is finished in end build. At this time, it unregisters any loggers attached to it.

  • The MuxLogger logs the build-finished event when the project-finished event for the first project-started event is seen for each logger.

The MuxLogger registers loggers in the following way:

  1. The logger is passed to the MuxLogger.RegisterLogger method with a submission ID that is used to route a message to that logger.

  2. The MuxLogger registers the logger to the MuxLogger event source.

  3. If the build-started event has already been logged, the MuxLogger creates a new build-started event and sends it to the logger's event source.

The MuxLogger unregisters loggers in the following way:

  1. When a build submission is completed, the MuxLogger.UnregisterLogger method is called with the submission ID for the logger.

  2. The MuxLogger looks up the success state of the project-finished event for the submission ID and logs a build-finished event to the logger.

  3. The MuxLogger cleans up the event source.

    Note that the unregister comes from a thread other than the logging thread and a synchronization issue could occur if unregister is called while events are being logged.

Constructors

MuxLogger()

Creates a new instance of the multiplexing logger.

Properties

Parameters

Gets or sets the Parameters attribute, required by the ILogger interface.

Verbosity

Gets or sets the Verbosity attribute, required by the ILogger interface.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
Initialize(IEventSource)

Initialize the MuxLogger instance with the specified event source.

Initialize(IEventSource, Int32)

Initialize the MuxLogger instance with the specified event source and specified maximum number of nodes.

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
RegisterLogger(Int32, ILogger)

Registers a logger on the MuxLogger and raises a build-started event if the build-started event has already been logged.

Shutdown()

Shuts down the MuxLogger and clears out any state.

ToString()

Returns a string that represents the current object.

(Inherited from Object)
UnregisterLoggers(Int32)

Removes the specified logger from the MuxLogger.

Applies to