-
-
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.
- Loading branch information
Showing
20 changed files
with
248 additions
and
199 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
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,9 @@ | ||
cmake_minimum_required(VERSION 3.25) | ||
|
||
project(ci VERSION 1.0.0 LANGUAGES CXX) | ||
set(CMAKE_VERBOSE_MAKEFILE ON) | ||
|
||
find_package(wwa_opentelemetry_exporter_syslog_logs CONFIG REQUIRED) | ||
|
||
add_executable(ci main.cpp) | ||
target_link_libraries(ci PRIVATE wwa::opentelemetry::syslog_log_record_exporter) |
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,28 @@ | ||
#include <opentelemetry/exporters/wwa/syslog/log_record_exporter_factory.h> | ||
#include <opentelemetry/logs/provider.h> | ||
#include <opentelemetry/sdk/logs/logger_provider.h> | ||
#include <opentelemetry/sdk/logs/simple_log_record_processor.h> | ||
|
||
namespace { | ||
|
||
void init_logging() | ||
{ | ||
auto exporter = wwa::opentelemetry::exporter::logs::SyslogLogRecordExporterFactory::Create("syslog-identifier"); | ||
|
||
auto processor = std::make_unique<opentelemetry::sdk::logs::SimpleLogRecordProcessor>(std::move(exporter)); | ||
|
||
auto provider = std::make_shared<opentelemetry::sdk::logs::LoggerProvider>(std::move(processor)); | ||
|
||
opentelemetry::logs::Provider::SetLoggerProvider( | ||
std::static_pointer_cast<opentelemetry::logs::LoggerProvider>(provider) | ||
); | ||
} | ||
|
||
} // namespace | ||
|
||
int main() | ||
{ | ||
init_logging(); | ||
opentelemetry::logs::Provider::GetLoggerProvider()->GetLogger("logger name", "somelib")->Info("test message"); | ||
return 0; | ||
} |
This file was deleted.
Oops, something went wrong.
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,14 @@ | ||
get_filename_component(WWA_OTEL_SYSLOG_EXPORTER_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) | ||
|
||
list(APPEND CMAKE_MODULE_PATH ${WWA_OTEL_SYSLOG_EXPORTER_CMAKE_DIR}) | ||
|
||
include(CMakeFindDependencyMacro) | ||
find_dependency(opentelemetry-cpp QUIET REQUIRED COMPONENTS logs) | ||
if(opentelemetry-cpp_VERSION VERSION_LESS 1.11.0) | ||
message(FATAL_ERROR "opentelemetry-cpp version must be at least 1.11.0, ${opentelemetry-cpp_VERSION} found") | ||
endif() | ||
|
||
if(NOT TARGET wwa_opentelemetry_exporter_syslog_logs) | ||
include("${WWA_OTEL_SYSLOG_EXPORTER_CMAKE_DIR}/wwa_opentelemetry_exporter_syslog_logs-target.cmake") | ||
add_library(wwa::opentelemetry::syslog_log_record_exporter ALIAS wwa_opentelemetry_exporter_syslog_logs) | ||
endif() |
36 changes: 36 additions & 0 deletions
36
include/opentelemetry/exporters/wwa/syslog/log_record_exporter_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,36 @@ | ||
#ifndef FD634219_63FB_4E23_BC1D_6DB0BC20B6BE | ||
#define FD634219_63FB_4E23_BC1D_6DB0BC20B6BE | ||
|
||
#include <memory> | ||
#include <opentelemetry/nostd/string_view.h> | ||
#include <opentelemetry/sdk/logs/exporter.h> | ||
|
||
#include "syslog_interface.h" | ||
#include "wwa_opentelemetry_exporter_syslog_logs_export.h" | ||
|
||
namespace wwa::opentelemetry::exporter::logs { | ||
|
||
class WWA_OPENTELEMETRY_EXPORTER_SYSLOG_LOGS_EXPORT SyslogLogRecordExporterFactory { | ||
public: | ||
static std::unique_ptr<::opentelemetry::sdk::logs::LogRecordExporter> | ||
Create(::opentelemetry::nostd::string_view ident); | ||
|
||
static std::unique_ptr<::opentelemetry::sdk::logs::LogRecordExporter> | ||
Create(::opentelemetry::nostd::string_view ident, int option, int facility); | ||
|
||
static std::unique_ptr<::opentelemetry::sdk::logs::LogRecordExporter> | ||
Create(::opentelemetry::nostd::string_view ident, const std::shared_ptr<SyslogInterface>& syslog); | ||
|
||
static std::unique_ptr<::opentelemetry::sdk::logs::LogRecordExporter> Create( | ||
::opentelemetry::nostd::string_view ident, | ||
const std::shared_ptr<SyslogInterface>& syslog, | ||
int option, | ||
int facility | ||
); | ||
|
||
static void setSyslogImplementation(const std::shared_ptr<SyslogInterface>& syslog); | ||
}; | ||
|
||
} // namespace wwa::opentelemetry::exporter::logs | ||
|
||
#endif /* FD634219_63FB_4E23_BC1D_6DB0BC20B6BE */ |
20 changes: 20 additions & 0 deletions
20
include/opentelemetry/exporters/wwa/syslog/syslog_interface.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,20 @@ | ||
#ifndef F6CC3A7F_2A2D_4616_B15D_A7739D98F053 | ||
#define F6CC3A7F_2A2D_4616_B15D_A7739D98F053 | ||
|
||
#include <opentelemetry/nostd/string_view.h> | ||
#include "wwa_opentelemetry_exporter_syslog_logs_export.h" | ||
|
||
namespace wwa::opentelemetry::exporter::logs { | ||
|
||
// NOLINTNEXTLINE(*-special-member-functions) | ||
class WWA_OPENTELEMETRY_EXPORTER_SYSLOG_LOGS_EXPORT SyslogInterface { | ||
public: | ||
virtual ~SyslogInterface() = default; | ||
virtual void openlog(::opentelemetry::nostd::string_view ident, int option, int facility) = 0; | ||
virtual void syslog(int priority, ::opentelemetry::nostd::string_view message) = 0; | ||
virtual void closelog() = 0; | ||
}; | ||
|
||
} // namespace wwa::opentelemetry::exporter::logs | ||
|
||
#endif /* F6CC3A7F_2A2D_4616_B15D_A7739D98F053 */ |
33 changes: 0 additions & 33 deletions
33
include/opentelemetry_exporter_syslog_logs/syslog_exporter_factory.h
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
include/opentelemetry_exporter_syslog_logs/syslog_interface.h
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.