-
Notifications
You must be signed in to change notification settings - Fork 379
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add formatting augmenter to console logging (#14284)
Closes #14260
- Loading branch information
1 parent
cac2084
commit e5d0659
Showing
4 changed files
with
184 additions
and
0 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
39 changes: 39 additions & 0 deletions
39
...gle.Cloud.Logging.Console/Google.Cloud.Logging.Console/IGoogleCloudConsoleLogAugmenter.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,39 @@ | ||
// Copyright 2025 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Extensions.Logging.Abstractions; | ||
using System.Text.Json; | ||
|
||
namespace Google.Cloud.Logging.Console; | ||
|
||
/// <summary> | ||
/// Allows augmenting formatted log entries with information not included by <see cref="GoogleCloudConsoleFormatter"/>. | ||
/// </summary> | ||
public interface IGoogleCloudConsoleLogAugmenter | ||
{ | ||
/// <summary> | ||
/// Augments the formatted log entry with information not included by <see cref="GoogleCloudConsoleFormatter"/>. | ||
/// </summary> | ||
/// <typeparam name="TState">The type of the state information attached to the log entry.</typeparam> | ||
/// <param name="logEntry">The log entry that's being formatted.</param> | ||
/// <param name="scopeProvider">The provider of scope data.</param> | ||
/// <param name="writer"> | ||
/// The JSON writer containing the start of the formatted log entry, meaning that | ||
/// <see cref="Utf8JsonWriter.WriteStartObject()" /> has been called for the top level JSON object and some fields have been written | ||
/// but <see cref="Utf8JsonWriter.WriteEndObject" /> is yet to be called for the top level JSON object. | ||
/// Do not call <see cref="Utf8JsonWriter.WriteEndObject" /> for the top level JSON object. | ||
/// </param> | ||
void AugmentFormattedLogEntry<TState>(in LogEntry<TState> logEntry, IExternalScopeProvider scopeProvider, Utf8JsonWriter writer); | ||
} |