Last active
December 28, 2015 14:59
-
-
Save JayBazuzi/7519004 to your computer and use it in GitHub Desktop.
Custom MSBuild logger - grabs only High importance messages, returns them as a string.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HighImportanceStringLogger : ILogger | |
{ | |
readonly private StringBuilder stringBuilder = new StringBuilder(); | |
public void Initialize(IEventSource eventSource) | |
{ | |
eventSource.MessageRaised += eventSource_MessageRaised; | |
} | |
void eventSource_MessageRaised(object sender, BuildMessageEventArgs e) | |
{ | |
if (e.Importance <= MessageImportance.High) | |
{ | |
stringBuilder.AppendLine(e.Message); | |
} | |
} | |
public string Parameters { get; set; } | |
public void Shutdown() { } | |
public LoggerVerbosity Verbosity { get; set; } | |
public override string ToString() | |
{ | |
return this.stringBuilder.ToString(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment