#pragma once #ifdef __cplusplus #include #include #include #include #include #include #else #include #include #endif #include "sl/strategies.h" /** * @brief represents a buffer strategy, generally as an obscure pointer */ struct sl_buffer_strategy; /** * @brief represents a sink strategy, generally as an obscure pointer */ struct sl_sink_strategy; /** * @brief represents an overflow strategy, generally as an obscure pointer */ struct sl_overflow_strategy; /** * @brief represents an output strategy, generally as an obscure pointer */ struct sl_output_strategy; #ifdef __cplusplus namespace sl { /** * @brief represents a c-style buffer strategy */ using buffer_strategy = sl_buffer_strategy; /** * @brief represents a c-style sink strategy */ using sink_strategy = sl_sink_strategy; /** * @brief represents a c-style overflow strategy */ using overflow_strategy = sl_overflow_strategy; /** * @brief represents a c-style output strategy */ using output_strategy = sl_output_strategy; } template void register_log(std::string_view buffer_filename, uint64_t buffer_size, uint64_t out_strategy_parameter, std::string_view output_directory); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); template<> void register_log(std::string_view, uint64_t, uint64_t, std::string_view); #else typedef struct sl_buffer_strategy sl_buffer_strategy; typedef struct sl_sink_strategy sl_sink_strategy; typedef struct sl_overflow_strategy sl_overflow_strategy; typedef struct sl_output_strategy sl_output_strategy; #endif #ifdef __cplusplus extern "C" { #endif /** * @brief Constructs a buffer strategy from C * @param strategy The type of strategy * @param filename A file describing the strategy, ignored if SL_BUFFER_TYPE is SL_INTERNAL, optional if SL_BUFFER_TYPE is SL_SHARED * @return a strategy token for building a logger */ sl_buffer_strategy* sl_create_buffer_strategy(SL_BUFFER_TYPE strategy, char *filename); /** * @brief Constructs a sink strategy for how to handle IO in the logger * @param strategy The type of strategy * @return a strategy token to build a logger */ sl_sink_strategy* sl_create_sink_strategy(SL_SINK_IO_TYPE strategy); /** * @brief Constructs an overflow strategy for how to handle the edge case of a full buffer * @param strategy The type of strategy * @return a strategy token to build a logger */ sl_overflow_strategy* sl_create_overflow_strategy(SL_ON_SINK_FULL strategy); /** * @brief Constructs a strategy that will direct where data is logged and how it will be split * @param strategy The strategy to use * @param strategy_parameter Either the amount of hours to keep in the same file, or the file size in kilobytes * @param output_directory The directory where the logs will be written * @return a strategy token to build a logger */ sl_output_strategy* sl_create_output_strategy(SL_ROLL_LOGS strategy, uint64_t strategy_parameter, char* output_directory); /** * @brief Constructs and registers a logger, readily available immediately * @param internal_id The ID with which you want to refer to the logger to access it as fast as possible * @param external_id The ID which will be part of the logs filename * @param strategies Collect the 4 tokens and reunite them into the hero's sword that will slay every other logger */ void sl_register_logger(int internal_id, char* external_id, sl_buffer_strategy*, sl_sink_strategy*, sl_overflow_strategy*, sl_output_strategy*); #ifdef __cplusplus } #endif