![]() |
VOOZH | about |
dotnet add package Serilog.Sinks.GoogleCloudLogging --version 5.0.0
NuGet\Install-Package Serilog.Sinks.GoogleCloudLogging -Version 5.0.0
<PackageReference Include="Serilog.Sinks.GoogleCloudLogging" Version="5.0.0" />
<PackageVersion Include="Serilog.Sinks.GoogleCloudLogging" Version="5.0.0" />Directory.Packages.props
<PackageReference Include="Serilog.Sinks.GoogleCloudLogging" />Project file
paket add Serilog.Sinks.GoogleCloudLogging --version 5.0.0
#r "nuget: Serilog.Sinks.GoogleCloudLogging, 5.0.0"
#:package Serilog.Sinks.GoogleCloudLogging@5.0.0
#addin nuget:?package=Serilog.Sinks.GoogleCloudLogging&version=5.0.0Install as a Cake Addin
#tool nuget:?package=Serilog.Sinks.GoogleCloudLogging&version=5.0.0Install as a Cake Tool
Serilog sink that writes events to Google Cloud Logging.
net6.0, net5.0, netstandard2.0dotnet add package Serilog.Sinks.GoogleCloudLogging
var config = new GoogleCloudLoggingSinkOptions { ProjectId = "YOUR_PROJECT_ID" };
Log.Logger = new LoggerConfiguration().WriteTo.GoogleCloudLogging(config).CreateLogger();
This requires the serilog-settings-configuration package.
"Serilog": {
"Using": [ "Serilog.Sinks.GoogleCloudLogging" ],
"MinimumLevel": "Information",
"WriteTo": [
{
"Name": "GoogleCloudLogging",
"Args": {
"projectID": "PROJECT-ID-12345",
"restrictedToMinimumLevel": "Information",
"labels": {
"foo": "bar"
}
}
}
]
}
var config = new ConfigurationBuilder().AddJsonFile("appsettings.json", optional: true, reloadOnChange: true).Build();
Log.Logger = new LoggerConfiguration().ReadFrom.Configuration(config).CreateLogger();
This library uses the Google Cloud .NET client and Application Default Credentials. The Logs Writer permission is required to send logs. There are several different ways to set credentials:
GOOGLE_APPLICATION_CREDENTIALS environment variable to specify the path to your JSON credentials file.GoogleCredentialJson config option to pass in the contents of your JSON credentials file.JsonPayload in the protobuf API) with labels, properties, metadata and any other data like stack traces automatically attached.double during serialization because that is the only numeric type supported by JSON. Large integers and floating-point values will lose precision. If you want the exact value preserved then log it as a string instead.| Option | Description |
|---|---|
| ProjectId | ID (not name) of GCP project where logs will be sent. Optional if running in GCP. Required if running elsewhere or to override the destination. |
| ResourceType | Resource type for logs. Automatically identified if running in GCP or will default to "global". See Monitored Resources and Services for supported types. |
| LogName | Name of the log. Default is "Default", or will use SourceContext is setting is enabled. |
| Labels | Optional Dictionary<string, string> labels added to all log entries. |
| ResourceLabels | Optional Dictionary<string, string> labels added to all log entries, for the resource type. See Monitored Resources and Services for recognized labels. |
| ServiceName | Name of the service added as metadata to log entries. Required for logged exceptions to be forwarded to StackDriver Error Reporting. |
| ServiceVersion | Version of the service added as metadata to log entries. Required for logged exceptions to be forwarded to StackDriver Error Reporting. |
| UseSourceContextAsLogName | The log name for a log entry will be set to the SourceContext property if available. Default is true. |
| UseLogCorrelation | Integrate logs with Cloud Trace by setting Trace, SpanId, TraceSampled properties if available. Default is true. |
| GoogleCredentialJson | Override Application Default Credentials with the content of a JSON credential file. |
This table shows the mapping from Serilog LogLevel to Google Cloud Logging LogSeverity
| Serilog | Cloud Logging |
|---|---|
| Verbose | Debug |
| Debug | Debug |
| Information | Info |
| Warning | Warning |
| Error | Error |
| Fatal | Critical |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 is compatible. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 netstandard2.1 is compatible. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on Serilog.Sinks.GoogleCloudLogging:
| Package | Downloads |
|---|---|
|
PegasusLoggingService
Package Description |
|
|
Pegasus_Logging
Package Description |
|
|
Findep.AspNetCore.Microservices
Core Library for FINDEP Microservices based on ASP.NET Core |
|
|
com.parallon.outpatient.serilog.sdk
A .NET 8 SDK for configuring and integrating Serilog logging, including enrichers and Google Cloud Logging support. |
|
|
Neocortex.Extension
Neocortex.Extension es una biblioteca de extensiones para .NET Core que proporciona integraciones fáciles para logging con Google y caching. Mejora el rendimiento de tus aplicaciones con un sistema de caché eficiente y una integración directa con los servicios de logging de Google. Características: Logging con Google: Registra eventos directamente en Google para monitoreo. Caché eficiente: Optimiza el rendimiento con almacenamiento en caché. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.0.0 | 5,152,558 | 6/14/2022 |
| 4.0.0 | 314,389 | 4/5/2022 |
| 3.7.0 | 186,233 | 2/20/2022 |
| 3.6.0 | 311,805 | 8/30/2021 |
| 3.5.0 | 52,604 | 6/10/2021 |
| 3.4.0 | 30,059 | 4/25/2021 |
| 3.3.3 | 74,984 | 3/15/2021 |
| 3.3.0 | 95,034 | 9/21/2020 |
| 3.2.0 | 90,773 | 6/18/2020 |
| 3.0.0 | 77,289 | 3/20/2020 |
| 2.4.1 | 4,358 | 3/18/2020 |
| 2.4.0 | 31,235 | 2/5/2020 |
| 2.3.0 | 3,773 | 1/15/2020 |
| 2.2.1 | 3,528 | 1/12/2020 |
| 2.2.0 | 29,957 | 10/8/2019 |
| 2.1.1 | 4,696 | 10/6/2019 |