Skip to content

How do I set thread_name? #617

Answered by odygrd
persona94 asked this question in Q&A
Oct 29, 2024 · 4 comments · 5 replies
Discussion options

You must be logged in to vote

This is an example of how you can track it with Logger instances

#include "quill/Backend.h"
#include "quill/Frontend.h"
#include "quill/LogMacros.h"
#include "quill/Logger.h"
#include "quill/sinks/JsonConsoleSink.h"

#include <string>

class CustomJsonConsoleSink : public quill::StreamSink
{
public:
  CustomJsonConsoleSink() : StreamSink("stdout", nullptr) {}
  ~CustomJsonConsoleSink() override = default;

  void write_log(quill::MacroMetadata const* log_metadata, uint64_t log_timestamp,
                 std::string_view thread_id, std::string_view thread_name,
                 std::string const& process_id, std::string_view logger_name, quill::LogLevel log_level,
                 std::st…

Replies: 4 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@persona94
Comment options

@odygrd
Comment options

@persona94
Comment options

Comment options

You must be logged in to vote
1 reply
@persona94
Comment options

Comment options

You must be logged in to vote
1 reply
@persona94
Comment options

Answer selected by persona94
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants