The Log Writer object provides a set of methods to register
text messages into the file system, most well known as log files. You
can define many log writer contexts that can be used on callbacks or
in other sections of the web service.
In order to handle multiple contexts and a high concurrency, the Log Writer core implements a thread worker that contains a buffer for each Log Writer context, so every time a log entry is registered, it's buffered into the queue and flushed to disk every three seconds or when the buffer reachs its 75% of capacity. A common buffer size is 65Kb.
It's mandatory that every Log Writer context must be initialized inside duda_main(), so it become available for the whole service when entering in the server loop.
The storage path for the file logs it is given by the LogDir entry in the [WEB_SERVICE] section from the virtual host definition. If you are using Duda Client Manager (DudaC) this is automatically configured when the 'logs' directory exists in the web service source code tree.
As an additional feature, each log context can be enabled/disabled on run time, to accomplish this just change the field 'enabled' to MK_TRUE or MK_FALSE, e.g: context.enabled = MK_FALSE.
This function initialize a Log Writter context for the web service, it can be used many times as required to initialize multiple contexts. It must be used ONLY inside duda_main().
int duda_logger_create(duda_logger_t *context, char *name);Parameters
It format and prints a customized message to the given Log Writer context. At the moment the only restriction of this method is that it cannot be used from duda_main().
int print(duda_logger_t *context, char *fmt, ...);Parameters