MXS-2014 Introduce possibility for providing log context

The current implementation of mxs_log_message() is otherwise
generic, but for the fact that the session id is automatically
injected into the message.

With this change, a mxs_log_init2() is introduced that in addition
to the existing parameters takes a function using which the context
can be provided. The implementation of mxs_log_init() now simply
calls mxs_log_init2() giving a function that provides the MaxScale
context.

This is in preparation for moving maxscale/log_manager.h to
maxbase/log.h.
This commit is contained in:
Johan Wikman
2018-08-15 10:55:23 +03:00
parent 3e0086cd09
commit f98cb0fe8d
2 changed files with 47 additions and 21 deletions

View File

@ -92,6 +92,8 @@ typedef struct mxs_log_throttling
size_t suppress_ms; // If exceeded, suppress such messages for this many ms.
} MXS_LOG_THROTTLING;
bool mxs_log_init2(const char* ident, const char* logdir, mxs_log_target_t target,
size_t (*get_context)(char*, size_t));
bool mxs_log_init(const char* ident, const char* logdir, mxs_log_target_t target);
void mxs_log_finish(void);
bool mxs_log_rotate();