forked from open-telemetry/opentelemetry-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix log sdk builder (open-telemetry#1486)
Implemented code review comments. Fixed typo (processor -> processors) in TracerContextFactory
- Loading branch information
Showing
6 changed files
with
92 additions
and
13 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
43 changes: 43 additions & 0 deletions
43
sdk/include/opentelemetry/sdk/logs/logger_context_factory.h
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,43 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#pragma once | ||
|
||
#ifdef ENABLE_LOGS_PREVIEW | ||
|
||
# include "opentelemetry/sdk/logs/logger_context.h" | ||
# include "opentelemetry/sdk/logs/processor.h" | ||
# include "opentelemetry/sdk/resource/resource.h" | ||
# include "opentelemetry/version.h" | ||
|
||
OPENTELEMETRY_BEGIN_NAMESPACE | ||
namespace sdk | ||
{ | ||
namespace logs | ||
{ | ||
|
||
/** | ||
* Factory class for LoggerContext. | ||
*/ | ||
class LoggerContextFactory | ||
{ | ||
public: | ||
/** | ||
* Create a LoggerContext. | ||
*/ | ||
static std::unique_ptr<LoggerContext> Create( | ||
std::vector<std::unique_ptr<LogProcessor>> &&processors); | ||
|
||
/** | ||
* Create a LoggerContext. | ||
*/ | ||
static std::unique_ptr<LoggerContext> Create( | ||
std::vector<std::unique_ptr<LogProcessor>> &&processors, | ||
const opentelemetry::sdk::resource::Resource &resource); | ||
}; | ||
|
||
} // namespace logs | ||
} // namespace sdk | ||
|
||
OPENTELEMETRY_END_NAMESPACE | ||
#endif |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#ifdef ENABLE_LOGS_PREVIEW | ||
|
||
# include "opentelemetry/sdk/logs/logger_context_factory.h" | ||
|
||
# include <memory> | ||
# include <vector> | ||
|
||
OPENTELEMETRY_BEGIN_NAMESPACE | ||
namespace sdk | ||
{ | ||
namespace logs | ||
{ | ||
|
||
std::unique_ptr<LoggerContext> LoggerContextFactory::Create( | ||
std::vector<std::unique_ptr<LogProcessor>> &&processors) | ||
{ | ||
auto resource = opentelemetry::sdk::resource::Resource::Create({}); | ||
return Create(std::move(processors), resource); | ||
} | ||
|
||
std::unique_ptr<LoggerContext> LoggerContextFactory::Create( | ||
std::vector<std::unique_ptr<LogProcessor>> &&processors, | ||
const opentelemetry::sdk::resource::Resource &resource) | ||
{ | ||
std::unique_ptr<LoggerContext> context(new LoggerContext(std::move(processors), resource)); | ||
return context; | ||
} | ||
|
||
} // namespace logs | ||
} // namespace sdk | ||
|
||
OPENTELEMETRY_END_NAMESPACE | ||
#endif |
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