Skip to content

Multiple Sinks? RotatingFile and Console for the same log? #629

Answered by odygrd
rhaley-starfish asked this question in Q&A
Discussion options

You must be logged in to vote

hey, you can do something like this:

#include "quill/Backend.h"
#include "quill/Frontend.h"
#include "quill/LogMacros.h"
#include "quill/Logger.h"
#include "quill/sinks/RotatingFileSink.h"
#include "quill/sinks/ConsoleSink.h"
#include <utility>

int main()
{
  // Start the backend thread
  quill::BackendOptions backend_options;
  quill::Backend::start(backend_options);

  // Frontend
  auto rotating_file_sink = quill::Frontend::create_or_get_sink<quill::RotatingFileSink>(
    "rotating_file.log",
    []()
    {
      // See RotatingFileSinkConfig for more options
      quill::RotatingFileSinkConfig cfg;
      cfg.set_open_mode('w');
      cfg.set_filename_append_option(quill::FilenameAppe…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@rhaley-starfish
Comment options

Answer selected by rhaley-starfish
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