[Logs SDK] Log Appender for spdlog#357
Conversation
instrumentation/spdlog/src/sink.cc
Outdated
| using namespace opentelemetry::trace::SemanticConventions; | ||
|
|
||
| log_record->SetSeverity(levelToSeverity(msg.level)); | ||
| log_record->SetBody(opentelemetry::nostd::string_view(msg.payload.data())); |
There was a problem hiding this comment.
This should either use string_view(msg.payload.data(), msg.payload.size()) or string_view(msg.payload.c_str()) to avoid out-of-bounds access?
There was a problem hiding this comment.
Makes sense, thanks! Good catch.
| RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
| LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
|
|
There was a problem hiding this comment.
Probably also makes sense to export the target itself so that it's easier to use this library in another cmake-based project, smth like
install(
EXPORT "${PROJECT_NAME}-target"
FILE "${PROJECT_NAME}-target.cmake"
NAMESPACE "${PROJECT_NAME}::"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
?
Ideally also a config (see e.g. https://cmake.org/cmake/help/latest/guide/importing-exporting/index.html#creating-a-package-configuration-file) for easier discoverability / reuse?
There was a problem hiding this comment.
That's reasonable, I'll have a look. I was seeing it as a Makefile-based build only.
marcalff
left a comment
There was a problem hiding this comment.
Thanks for the contribution.
Implemented as described in open-telemetry/opentelemetry-cpp#2046: