A C++ library for logging very fast and without allocating.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

43 lignes
1.8 KiB

  1. #pragma once
  2. /**
  3. * @brief Describes what should happen if the allocated buffer is full and no logs can be written
  4. */
  5. enum SL_ON_SINK_FULL {
  6. SL_OVERFLOW = 1, /**< When the sink is full, we want to drop the oldest data even if it is not written yet */
  7. SL_WAIT = 2 /**< When the sink is full, we want to wait for the next write. Do that if log keeping is critical */
  8. };
  9. /**
  10. * @brief Describes what type of IO should be used to log your data
  11. */
  12. enum SL_SINK_IO_TYPE {
  13. SL_DIRECT_IO = 1, /**< Use IO that ensure data is written on disk as soon as possible. Useful for debugging. */
  14. 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. */
  15. SL_FASTEST_IO = 3, /**< Write with the highest throughput. */
  16. SL_EXTERNAL_IO = 4 /**< Do not handle any IO. Writes to a memory mapped file and let another process handle the IO. */
  17. };
  18. /**
  19. * @brief What type of buffer should we use?
  20. */
  21. enum SL_BUFFER_TYPE {
  22. SL_EXTERNAL = 1, /**< Use a provided memory mapped non-temporary file */
  23. SL_SHARED = 2, /**< Use an automatically generated temporary file */
  24. SL_INTERNAL = 3 /**< Use internal memory. Compatible only with the SL_SINK_IO_TYPE: SL_DIRECT_IO and SL_FASTEST_IO. */
  25. };
  26. /**
  27. * @brief On what basis do we generate new files for logs?
  28. */
  29. enum SL_ROLL_LOGS {
  30. SL_BY_TIME = 1, /**< Will create a new log every n-hours */
  31. SL_BY_SIZE = 2, /**< Will create a new log every n-KB */
  32. SL_NEVER = 0 /**< Will never split the log. Use when doing external logging. */
  33. };
  34. #ifndef __cplusplus
  35. typedef enum SL_ON_SINK_FULL SL_ON_SINK_FULL;
  36. typedef enum SL_SINK_IO_TYPE SL_SINK_IO_TYPE;
  37. typedef enum SL_BUFFER_TYPE SL_BUFFER_TYPE;
  38. typedef enum SL_ROLL_LOGS SL_ROLL_LOGS;
  39. #endif