/// <summary> /// This method is called by the node loggers to forward the events to cenral logger /// </summary> void IEventRedirector.ForwardEvent(BuildEventArgs buildEvent) { // Don't allow forwarding loggers to forward build started ErrorUtilities.VerifyThrowInvalidOperation(!(buildEvent is BuildStartedEventArgs), "DontForwardBuildStarted"); // Don't allow forwarding loggers to forward build finished ErrorUtilities.VerifyThrowInvalidOperation(!(buildEvent is BuildFinishedEventArgs), "DontForwardBuildFinished"); // Mark the event with the logger id metadata and post it to the queue NodeLoggingEventWithLoggerId loggingEvent = new NodeLoggingEventWithLoggerId(buildEvent, loggerId); loggingService.PostLoggingEvent(loggingEvent); }
/// <summary> /// Logs that the build has finished to a particular logger Id /// </summary> virtual internal void LogBuildFinished(bool success, int loggerId) { // If we're only logging critical events, don't risk causing all the resources to load by formatting // a string that won't get emitted anyway. string message = String.Empty; if (!OnlyLogCriticalEvents) { message = ResourceUtilities.FormatResourceString(success ? "BuildFinishedSuccess" : "BuildFinishedFailure"); } BuildFinishedEventArgs e = new BuildFinishedEventArgs(message, null /* no help keyword */, success); // Wrap the BuildFinished event so it is only sent to the loggers to // the specified logger id NodeLoggingEventWithLoggerId nodeEvent = new NodeLoggingEventWithLoggerId(e, loggerId); PostLoggingEvent(nodeEvent); }
/************************************************************************************************************************** * WARNING: Do not add overloads that allow raising events without specifying a file. In general ALL events should have a * file associated with them. We've received a LOT of feedback from dogfooders about the lack of information in our * events. If an event TRULY does not have an associated file, then String.Empty can be passed in for the file. However, * that burden should lie on the caller -- these wrapper methods should NOT make it easy to skip the filename. *************************************************************************************************************************/ /// <summary> /// Logs that the build has started with all loggers (only called on the main node) /// </summary> virtual internal void LogBuildStarted() { // If we're only logging critical events, don't risk causing all the resources to load by formatting // a string that won't get emitted anyway. string message = String.Empty; if (!OnlyLogCriticalEvents) { message = ResourceUtilities.FormatResourceString("BuildStarted"); } BuildStartedEventArgs e = new BuildStartedEventArgs(message, null /* no help keyword */); PostLoggingEvent(e); // Wrap the event to be sent to central loggers NodeLoggingEventWithLoggerId nodeEventToCentralLoggers = new NodeLoggingEventWithLoggerId(e, EngineLoggingServicesInProc.ALL_PRIVATE_EVENTSOURCES); PostLoggingEvent(nodeEventToCentralLoggers); }
internal void CreateFromStream(BinaryReader reader, Hashtable loggingTypeCache) { base.CreateFromStream(reader); int numberOfNodeEvents = reader.ReadInt32(); buildEvents = new NodeLoggingEvent[numberOfNodeEvents]; for (int i = 0; i < numberOfNodeEvents; i++) { NodeLoggingEvent e = null; if (reader.ReadByte() == 0) { e = new NodeLoggingEvent(); } else { e = new NodeLoggingEventWithLoggerId(); } e.CreateFromStream(reader, loggingTypeCache); buildEvents[i] = e; } }