From 36d53194886ae208af042e8d324f50fe617474dc Mon Sep 17 00:00:00 2001 From: Timothy Mothra Date: Fri, 11 Mar 2022 17:40:17 -0800 Subject: [PATCH] Logs customization doc: skeleton (#3030) --- OpenTelemetry.sln | 7 +++ docs/logs/customizing-the-sdk/Program.cs | 39 +++++++++++++++ docs/logs/customizing-the-sdk/README.md | 49 +++++++++++++++++++ .../customizing-the-sdk.csproj | 6 +++ docs/logs/getting-started/README.md | 2 + 5 files changed, 103 insertions(+) create mode 100644 docs/logs/customizing-the-sdk/Program.cs create mode 100644 docs/logs/customizing-the-sdk/README.md create mode 100644 docs/logs/customizing-the-sdk/customizing-the-sdk.csproj diff --git a/OpenTelemetry.sln b/OpenTelemetry.sln index 1a12155fb..d99b21e04 100644 --- a/OpenTelemetry.sln +++ b/OpenTelemetry.sln @@ -226,6 +226,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "source-generation", "docs\l EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "getting-started-prometheus-grafana", "docs\metrics\getting-started-prometheus-grafana\getting-started-prometheus-grafana.csproj", "{41B784AA-3301-4126-AF9F-1D59BD04B0BF}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "customizing-the-sdk", "docs\logs\customizing-the-sdk\customizing-the-sdk.csproj", "{6C7A1595-36D6-4229-BBB5-5A6B5791791D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -472,6 +474,10 @@ Global {41B784AA-3301-4126-AF9F-1D59BD04B0BF}.Debug|Any CPU.Build.0 = Debug|Any CPU {41B784AA-3301-4126-AF9F-1D59BD04B0BF}.Release|Any CPU.ActiveCfg = Release|Any CPU {41B784AA-3301-4126-AF9F-1D59BD04B0BF}.Release|Any CPU.Build.0 = Release|Any CPU + {6C7A1595-36D6-4229-BBB5-5A6B5791791D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6C7A1595-36D6-4229-BBB5-5A6B5791791D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6C7A1595-36D6-4229-BBB5-5A6B5791791D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6C7A1595-36D6-4229-BBB5-5A6B5791791D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -509,6 +515,7 @@ Global {0076C657-564F-4787-9FFF-52D9D55166E8} = {77C7929A-2EED-4AA6-8705-B5C443C8AA0F} {1F6CC903-04C9-4E7C-B388-C215C467BFB9} = {3862190B-E2C5-418E-AFDC-DB281FB5C705} {41B784AA-3301-4126-AF9F-1D59BD04B0BF} = {3277B1C0-BDFE-4460-9B0D-D9A661FB48DB} + {6C7A1595-36D6-4229-BBB5-5A6B5791791D} = {3862190B-E2C5-418E-AFDC-DB281FB5C705} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {55639B5C-0770-4A22-AB56-859604650521} diff --git a/docs/logs/customizing-the-sdk/Program.cs b/docs/logs/customizing-the-sdk/Program.cs new file mode 100644 index 000000000..a88618e64 --- /dev/null +++ b/docs/logs/customizing-the-sdk/Program.cs @@ -0,0 +1,39 @@ +// +// Copyright The OpenTelemetry Authors +// +// 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 +// +// http://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 OpenTelemetry.Logs; + +public class Program +{ + public static void Main() + { + using var loggerFactory = LoggerFactory.Create(builder => + { + builder.AddOpenTelemetry(options => + { + options.AddConsoleExporter(); + }); + }); + + var logger = loggerFactory.CreateLogger(); + + logger.LogInformation("Hello Information"); + logger.LogWarning("Hello Warning"); + logger.LogError("Hello Error"); + } +} diff --git a/docs/logs/customizing-the-sdk/README.md b/docs/logs/customizing-the-sdk/README.md new file mode 100644 index 000000000..5a225f713 --- /dev/null +++ b/docs/logs/customizing-the-sdk/README.md @@ -0,0 +1,49 @@ +# Customizing OpenTelemetry .NET SDK for Logs + +## OpenTelemetryLoggerProvider + +TODO + +## Building the OpenTelemetryLoggerProvider + +TODO + +## OpenTelemetryLoggerProvider configuration + +TODO + +### IncludeScopes + +TODO + +### IncludeFormattedMessage + +TODO + +### ParseStateValues + +TODO + +### AddProcessor + +TODO + +### SetResourceBuilder + +TODO + +## Filtering LogLevels + +TODO + +### via appsettings.json + +TODO + +### via code + +TODO + +## Learn more + +* TODO diff --git a/docs/logs/customizing-the-sdk/customizing-the-sdk.csproj b/docs/logs/customizing-the-sdk/customizing-the-sdk.csproj new file mode 100644 index 000000000..a0d4b1e14 --- /dev/null +++ b/docs/logs/customizing-the-sdk/customizing-the-sdk.csproj @@ -0,0 +1,6 @@ + + + + + + diff --git a/docs/logs/getting-started/README.md b/docs/logs/getting-started/README.md index 948913167..c8834bc94 100644 --- a/docs/logs/getting-started/README.md +++ b/docs/logs/getting-started/README.md @@ -63,3 +63,5 @@ console. * If you want to build a custom exporter/processor/sampler, refer to [extending the SDK](../extending-the-sdk/README.md). +* If you want to customize the SDK, refer to [customizing + the SDK](../customizing-the-sdk/README.md).