Skip to content

Instantly share code, notes, and snippets.

@he-dev he-dev/Main with logging.cs Secret
Last active Jun 21, 2017

Embed
What would you like to do?
private static int Main(string[] args)
{
var mainLogEntry = LogEntry.New().MessageBuilder(sb => sb.Append($"*** {Name} v{Version}").Stopwatch(sw => sw.StartNew());
try
{
// ...
mainLogEntry.Info().MessageBuilder(sb => sb.Append("exited.");
return 0;
}
catch (Exception ex)
{
mainLogEntry.Fatal().MessageBuilder(sb => sb.Append("crashed.").Exception(ex);
return 1;
}
finally
{
mainLogEntry.Log(Logger);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.