Skip to content

Commit

Permalink
add default initialization to logger with Core as the app name (#2469)
Browse files Browse the repository at this point in the history
  • Loading branch information
gjedlicska authored Apr 21, 2023
1 parent 6f5b88c commit f2eca41
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Core/Core/Logging/SpeckleLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,15 @@ public static class SpeckleLog
{
private static ILogger? _logger;

public static ILogger Logger => _logger ?? throw new SpeckleException(
$"The logger has not been initialized. Please call {typeof(SpeckleLog).FullName}.{nameof(Initialize)}");
public static ILogger Logger
{
get
{
if(_logger == null) Initialize("Core", "unknown");
return _logger;
}
}

private static bool _initialized = false;

/// <summary>
Expand Down

0 comments on commit f2eca41

Please sign in to comment.