Skip to content

User-Defined Sink: Caching logs before network interface is instantiated #566

Answered by odygrd
jmsargent9 asked this question in Q&A
Discussion options

You must be logged in to vote

hey, would something like this work ? You will need to log something on that Sink after the network interface is instantiated in order to trigger clearing the cache.
It is also possible to use run_periodic_tasks() for doing this if you log nothing after the network interface is instantiated but it's simpler to just log something because you don't know if run_periodic_tasks() or write_log() will be called next, you will need an additional variable if run_periodic_tasks() is used to clear the cache after the network instantiaton

class UserSink final : public quill::Sink
{
public:
  UserSink() = default;

  /***/
  void write_log(quill::MacroMetadata const* /** log_metadata **/, uint64_t /**…

Replies: 2 comments 1 reply

Comment options

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

Answer selected by jmsargent9
Comment options

You must be logged in to vote
0 replies
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