-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ability to create scoped work in singleton event producers.
- Loading branch information
1 parent
30de666
commit 07875b8
Showing
15 changed files
with
141 additions
and
42 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,57 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Diagnostics; | ||
|
||
namespace Microsoft.Extensions.Logging | ||
{ | ||
public static class ILoggerExtensions | ||
{ | ||
|
||
public static void LogInformation(this ILogger logger, string? message, object[]? @params, bool outputToConsole = false) | ||
{ | ||
logger.LogInformation(message, @params); | ||
|
||
if (outputToConsole) | ||
{ | ||
OutputToConsole(message, @params); | ||
} | ||
} | ||
|
||
public static void LogInformation(this ILogger logger, EventId eventId, string? message, object[]? @params, bool outputToConsole = false) | ||
{ | ||
logger.LogInformation(eventId, message, @params); | ||
|
||
if (outputToConsole) | ||
{ | ||
OutputToConsole(message, @params); | ||
} | ||
} | ||
|
||
public static void LogInformation(this ILogger logger, Exception exception, string? message, object[]? @params, bool outputToConsole = false) | ||
{ | ||
logger.LogInformation(exception, message, @params); | ||
|
||
if (outputToConsole) | ||
{ | ||
OutputToConsole(message, @params); | ||
} | ||
} | ||
|
||
public static void LogInformation(this ILogger logger, EventId eventId, Exception exception, string? message, object[]? @params, bool outputToConsole = false) | ||
{ | ||
logger.LogInformation(eventId, exception, message, @params); | ||
|
||
if (outputToConsole) | ||
{ | ||
OutputToConsole(message, @params); | ||
} | ||
} | ||
|
||
private static void OutputToConsole(string? message, object[]? @params) | ||
{ | ||
System.Console.WriteLine(message, @params); | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.