-
-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from adamhathcock/logging
Logging
- Loading branch information
Showing
8 changed files
with
79 additions
and
12 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Proto | ||
{ | ||
public static class Log | ||
{ | ||
private static ILoggerFactory loggerFactory = new NullLoggerFactory(); | ||
|
||
public static void SetLoggerFactory(ILoggerFactory loggerFactory) | ||
{ | ||
Log.loggerFactory = loggerFactory; | ||
} | ||
|
||
public static ILogger CreateLogger(string categoryName) | ||
{ | ||
return loggerFactory.CreateLogger(categoryName); | ||
} | ||
|
||
public static ILogger CreateLogger<T>() | ||
{ | ||
return loggerFactory.CreateLogger<T>(); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Extensions.Logging.Abstractions; | ||
|
||
namespace Proto | ||
{ | ||
public class NullLoggerFactory : ILoggerFactory | ||
{ | ||
public static readonly NullLoggerFactory Instance = new NullLoggerFactory(); | ||
|
||
public ILogger CreateLogger(string name) | ||
{ | ||
return NullLogger.Instance; | ||
} | ||
|
||
public void AddProvider(ILoggerProvider provider) | ||
{ | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
} | ||
} | ||
} |
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
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