Files
Jason Rhinelander c75357dc28 Replace callback logger; de-header oxen-logging and spdlog
The spdlog callback_sink_mt is kind of gross to use: you get passed a
reference to an internal struct, and the sink's formatter gets
completely ignored (requiring you to maintain your *own* formatter
rather than the one that is right there).

This updates to a new oxen-logging commit that adds a
`formatted_callback_sink` that provides a nicer interface.  Other
related changes here:

- Remove oxen-logging and spdlog use from headers; if they are in the
  headers then they become obligatory dev packages for libsession-util
  itself (i.e. code trying to compile against libsession-util has to
  have oxen-logging and spdlog available, rather than have those remain
  private implementation details of libsession-util itself).

- The above required re-introducing a LogLevel that (somewhat)
  duplicates oxen::log::Level, but I tried to make it somewhat
  transparent and auto-converting to be easy to use.  (To do all that
  required making it a struct rather than an enum, but it works somewhat
  similarly to an enum class).

- Move the Network::add_logger out of Network to be a free function (not
  in the session/logging.hpp header) as the logging system is
  process-wide and isn't really specific to Network (we'll almost
  certainly expand it into other parts of libsession-util before too
  long).  This also means you can set up a logger *before* creating a
  network, to get early-Network log statements as well.
2024-05-07 19:33:55 -03:00

21 lines
368 B
C

#pragma once
#ifdef __cplusplus
extern "C" {
#endif
// Note: These values must match the values in spdlog::level::level_enum
typedef enum LOG_LEVEL {
LOG_LEVEL_TRACE = 0,
LOG_LEVEL_DEBUG = 1,
LOG_LEVEL_INFO = 2,
LOG_LEVEL_WARN = 3,
LOG_LEVEL_ERROR = 4,
LOG_LEVEL_CRITICAL = 5,
LOG_LEVEL_OFF = 6,
} LOG_LEVEL;
#ifdef __cplusplus
}
#endif