Skip to content

Conversation

@kinyoklion
Copy link
Member

@kinyoklion kinyoklion commented May 15, 2023

Added support for configuring logging.

Did not add c-bindings yet.

std::chrono::seconds{30}))
.WithReasons(true)
.UseReport(true))
.Logging(LoggingBuilder::BasicLogging().Level(LogLevel::kDebug))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some implicit constructors to make setting the logging method simpler. Here there is a basic logging builder getting converted into a LoggingBuilder.

#include <launchdarkly/config/client.hpp>
#include <launchdarkly/config/server.hpp>
#include "null_logger.hpp"
#include <launchdarkly/logging/null_logger.hpp>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Null logger is now used to disable logging. So it was moved to internal.

private:
LogLevel level_;
std::string name_;
std::mutex write_mutex_;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to allow log entries not to overlap. If you want a high performance lock-free logger, then replace our logger.

@kinyoklion kinyoklion requested a review from cwaldren-ld May 15, 2023 23:52
@kinyoklion kinyoklion removed the request for review from cwaldren-ld May 15, 2023 23:55
@kinyoklion kinyoklion marked this pull request as draft May 15, 2023 23:55
@kinyoklion kinyoklion marked this pull request as ready for review May 16, 2023 00:01
* @return Returns true if the level is enabled.
*/
virtual bool Enabled(LogLevel level) = 0;
virtual bool Enabled(LogLevel level) noexcept = 0;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seemed like a good idea to make these noexcept.

@kinyoklion kinyoklion merged commit 6516711 into main May 16, 2023
@kinyoklion kinyoklion deleted the rlamb/logging-configuration branch May 16, 2023 00:21
@github-actions github-actions bot mentioned this pull request May 16, 2023
@github-actions github-actions bot mentioned this pull request May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants