Nandel.Extensions.Serilog.GoogleAgentTextFormatter 1.0.0-alpha.2

This is a prerelease version of Nandel.Extensions.Serilog.GoogleAgentTextFormatter.
dotnet add package Nandel.Extensions.Serilog.GoogleAgentTextFormatter --version 1.0.0-alpha.2
                    
NuGet\Install-Package Nandel.Extensions.Serilog.GoogleAgentTextFormatter -Version 1.0.0-alpha.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Nandel.Extensions.Serilog.GoogleAgentTextFormatter" Version="1.0.0-alpha.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nandel.Extensions.Serilog.GoogleAgentTextFormatter" Version="1.0.0-alpha.2" />
                    
Directory.Packages.props
<PackageReference Include="Nandel.Extensions.Serilog.GoogleAgentTextFormatter" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Nandel.Extensions.Serilog.GoogleAgentTextFormatter --version 1.0.0-alpha.2
                    
#r "nuget: Nandel.Extensions.Serilog.GoogleAgentTextFormatter, 1.0.0-alpha.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Nandel.Extensions.Serilog.GoogleAgentTextFormatter@1.0.0-alpha.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Nandel.Extensions.Serilog.GoogleAgentTextFormatter&version=1.0.0-alpha.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Nandel.Extensions.Serilog.GoogleAgentTextFormatter&version=1.0.0-alpha.2&prerelease
                    
Install as a Cake Tool

GoogleAgentTextFormatter for Serilog

The GoogleAgentTextFormatter is a custom Serilog text formatter that formats log events in a way that is compatible with Google Cloud Platform (GCP) logging services. This formatter allows your application logs to be interpreted correctly by GCP solutions like Cloud Run, enabling seamless integration with Google Cloud Platform monitoring tools.

Installation

To install the Nandel.Extensions.Serilog.GoogleAgentTextFormatter NuGet package, run the following command in your package manager console:

Install-Package Nandel.Extensions.Serilog.GoogleAgentTextFormatter

Alternatively, you can add it to your project file (.csproj) directly:

<PackageReference Include="Nandel.Extensions.Serilog.GoogleAgentTextFormatter" Version="1.0.0-alpha.2" />

Usage

1. In Code

To use the GoogleAgentTextFormatter in your application, you need to configure Serilog to use this formatter. Here’s an example of how to set it up in your code:

using Serilog;

class Program
{
    static void Main(string[] args)
    {
        Log.Logger = new LoggerConfiguration()
            .WriteTo.Console(new GoogleAgentTextFormatter()) // Updated formatter
            .CreateLogger();

        Log.Information("This is an information log.");
        Log.Error("This is an error log with an exception.", new Exception("Sample exception"));

        Log.CloseAndFlush();
    }
}

2. Using App Settings

You can also configure the GoogleAgentTextFormatter through your application settings (e.g., appsettings.json). Here’s how you can do it:

{
  "Serilog": {
    "Using": [ "Nandel.Extensions.Serilog.GoogleAgentTextFormatter" ],
    "WriteTo": [
      {
        "Name": "Console",
        "Args": {
          "formatter": "Nandel.Extensions.Serilog.GoogleAgentTextFormatter, Nandel.Extensions.Serilog.GoogleAgentTextFormatter"
        }
      }
    ]
  }
}

Summary

The GoogleAgentTextFormatter is designed to ensure that your application's log output is formatted in a way that is compatible with GCP's logging services. By using this formatter, you can easily integrate your application logs with Google Cloud Platform monitoring solutions, allowing for better observability and management of your cloud applications.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.2 474 3/23/2025
1.0.0-alpha.1 285 3/23/2025
1.0.0-alpha.0 173 3/23/2025