Skip to content

Instantly share code, notes, and snippets.

@he-dev
Last active June 21, 2017 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save he-dev/21aad8ccb458056f12556c030692ad9b to your computer and use it in GitHub Desktop.
Save he-dev/21aad8ccb458056f12556c030692ad9b to your computer and use it in GitHub Desktop.
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