A C++ library for logging very fast and without allocating.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

37 linhas
1.6 KiB

#pragma once
/**
* @brief Describes what should happen if the allocated buffer is full and no logs can be written
*/
enum SL_ON_SINK_FULL {
SL_OVERFLOW = 1, /**< When the sink is full, we want to drop the oldest data even if it is not written yet */
SL_WAIT = 2 /**< When the sink is full, we want to wait for the next write. Do that if log keeping is critical */
};
/**
* @brief Describes what type of IO should be used to log your data
*/
enum SL_SINK_IO_TYPE {
SL_DIRECT_IO = 1, /**< Use IO that ensure data is written on disk as soon as possible. Useful for debugging. */
SL_MMAPED_IO = 2, /**< Use IO that ensures that logging data will survive a software crash by using a memory mapped file as buffer. You can later expunge that buffer to get the useful information out. */
SL_FASTEST_IO = 3, /**< Write with the highest throughput. */
SL_EXTERNAL_IO = 4 /**< Do not handle any IO. Writes to a memory mapped file and let another process handle the IO. */
};
/**
* @brief What type of buffer should we use?
*/
enum SL_BUFFER_TYPE {
SL_EXTERNAL = 1, /**< Use a provided memory mapped non-temporary file */
SL_SHARED = 2, /**< Use an automatically generated temporary file */
SL_INTERNAL = 3 /**< Use internal memory. Compatible only with the SL_SINK_IO_TYPE: SL_DIRECT_IO and SL_FASTEST_IO. */
};
/**
* @brief On what basis do we generate new files for logs?
*/
enum SL_ROLL_LOGS {
SL_BY_TIME = 1, /**< Will create a new log every n-hours */
SL_BY_SIZE = 2, /**< Will create a new log every n-KB */
SL_NEVER = 0 /**< Will never split the log. Use when doing external logging. */
};