NVIDIA DeepStream SDK API Reference

9.2 Release
9.2/includes/opentelemetry/sdk/logs/logger.h
Go to the documentation of this file.
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3 
4 #pragma once
5 
6 #include <memory>
7 #include <string>
8 
9 #include "logger_config.h"
10 #include "opentelemetry/logs/log_record.h"
11 #include "opentelemetry/logs/logger.h"
12 #include "opentelemetry/logs/noop.h"
13 #include "opentelemetry/nostd/string_view.h"
14 #include "opentelemetry/nostd/unique_ptr.h"
15 #include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h"
16 #include "opentelemetry/sdk/logs/logger_context.h"
17 #include "opentelemetry/version.h"
18 
20 namespace sdk
21 {
22 namespace logs
23 {
24 
25 class Logger final : public opentelemetry::logs::Logger
26 {
27 public:
33  explicit Logger(
35  std::shared_ptr<LoggerContext> context,
36  std::unique_ptr<instrumentationscope::InstrumentationScope> instrumentation_scope =
38 
42  const opentelemetry::nostd::string_view GetName() noexcept override;
43 
44  nostd::unique_ptr<opentelemetry::logs::LogRecord> CreateLogRecord() noexcept override;
45 
47 
48  void EmitLogRecord(
49  nostd::unique_ptr<opentelemetry::logs::LogRecord> &&log_record) noexcept override;
50 
52  const opentelemetry::sdk::instrumentationscope::InstrumentationScope &GetInstrumentationScope()
53  const noexcept;
54 
56  const opentelemetry::sdk::instrumentationscope::InstrumentationScope &GetInstrumentationLibrary()
57  const noexcept
58  {
59  return GetInstrumentationScope();
60  }
61 
62 private:
63  // The name of this logger
64  std::string logger_name_;
65 
66  // order of declaration is important here - instrumentation scope should destroy after
67  // logger-context.
68  std::unique_ptr<instrumentationscope::InstrumentationScope> instrumentation_scope_;
69  std::shared_ptr<LoggerContext> context_;
70  LoggerConfig logger_config_;
71  static opentelemetry::logs::NoopLogger kNoopLogger;
72 };
73 
74 } // namespace logs
75 } // namespace sdk
sdk::logs::Logger::Logger
Logger(opentelemetry::nostd::string_view name, std::shared_ptr< LoggerContext > context, std::unique_ptr< instrumentationscope::InstrumentationScope > instrumentation_scope=instrumentationscope::InstrumentationScope::Create("")) noexcept
Initialize a new logger.
nostd::unique_ptr
std::unique_ptr< _Types... > unique_ptr
Definition: includes/opentelemetry/std/unique_ptr.h:19
nostd
Definition: includes/opentelemetry/nostd/function_ref.h:14
sdk::logs::Logger::GetInstrumentationLibrary
const opentelemetry::sdk::instrumentationscope::InstrumentationScope & GetInstrumentationLibrary() const noexcept
Definition: includes/opentelemetry/sdk/logs/logger.h:56
logs
Definition: includes/opentelemetry/logs/event_id.h:13
sdk::logs::Logger::GetInstrumentationScope
const opentelemetry::sdk::instrumentationscope::InstrumentationScope & GetInstrumentationScope() const noexcept
Returns the associated instrumentation scope.
OPENTELEMETRY_BEGIN_NAMESPACE
#define OPENTELEMETRY_BEGIN_NAMESPACE
Definition: includes/opentelemetry/version.h:21
context
Definition: includes/opentelemetry/context/context.h:16
OPENTELEMETRY_END_NAMESPACE
#define OPENTELEMETRY_END_NAMESPACE
Definition: includes/opentelemetry/version.h:24
logger_config.h
sdk::logs::Logger::GetName
const opentelemetry::nostd::string_view GetName() noexcept override
Returns the name of this logger.
sdk::logs::LoggerConfig
LoggerConfig defines various configurable aspects of a Logger's behavior.
Definition: includes/opentelemetry/sdk/logs/logger_config.h:19
sdk
Definition: includes/opentelemetry/sdk/common/atomic_shared_ptr.h:13
sdk::logs::Logger::CreateLogRecord
nostd::unique_ptr< opentelemetry::logs::LogRecord > CreateLogRecord() noexcept override
Logger
Definition: sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/engine_builder.h:50
sdk::logs::Logger::EmitLogRecord
void EmitLogRecord(nostd::unique_ptr< opentelemetry::logs::LogRecord > &&log_record) noexcept override
sdk::instrumentationscope::InstrumentationScope::Create
static nostd::unique_ptr< InstrumentationScope > Create(nostd::string_view name, nostd::string_view version="", nostd::string_view schema_url="", InstrumentationScopeAttributes &&attributes={})
Returns a newly created InstrumentationScope with the specified library name and version.
Definition: includes/opentelemetry/sdk/instrumentationscope/instrumentation_scope.h:39
opentelemetry
Definition: includes/opentelemetry/exporters/otlp/otlp_grpc_client.h:38
nostd::string_view
std::string_view string_view
Definition: includes/opentelemetry/std/string_view.h:18
OPENTELEMETRY_DEPRECATED_MESSAGE
#define OPENTELEMETRY_DEPRECATED_MESSAGE(msg)
Definition: includes/opentelemetry/common/macros.h:244