-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds Console Log Formatting APIs (#38616)
- Loading branch information
1 parent
687177b
commit 69d98ee
Showing
47 changed files
with
3,033 additions
and
727 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
62 changes: 62 additions & 0 deletions
62
src/libraries/Microsoft.Extensions.Logging.Abstractions/src/LogEntry.cs
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,62 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
|
||
namespace Microsoft.Extensions.Logging.Abstractions | ||
{ | ||
/// <summary> | ||
/// Holds the information for a single log entry. | ||
/// </summary> | ||
public readonly struct LogEntry<TState> | ||
{ | ||
/// <summary> | ||
/// Initializes an instance of the LogEntry struct. | ||
/// </summary> | ||
/// <param name="logLevel">The log level.</param> | ||
/// <param name="category">The category name for the log.</param> | ||
/// <param name="eventId">The log event Id.</param> | ||
/// <param name="state">The state for which log is being written.</param> | ||
/// <param name="exception">The log exception.</param> | ||
/// <param name="formatter">The formatter.</param> | ||
public LogEntry(LogLevel logLevel, string category, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter) | ||
{ | ||
LogLevel = logLevel; | ||
Category = category; | ||
EventId = eventId; | ||
State = state; | ||
Exception = exception; | ||
Formatter = formatter; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the LogLevel | ||
/// </summary> | ||
public LogLevel LogLevel { get; } | ||
|
||
/// <summary> | ||
/// Gets the log category | ||
/// </summary> | ||
public string Category { get; } | ||
|
||
/// <summary> | ||
/// Gets the log EventId | ||
/// </summary> | ||
public EventId EventId { get; } | ||
|
||
/// <summary> | ||
/// Gets the TState | ||
/// </summary> | ||
public TState State { get; } | ||
|
||
/// <summary> | ||
/// Gets the log exception | ||
/// </summary> | ||
public Exception Exception { get; } | ||
|
||
/// <summary> | ||
/// Gets the formatter | ||
/// </summary> | ||
public Func<TState, Exception, string> Formatter { get; } | ||
} | ||
} |
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.