Repo-Init
 
Loading...
Searching...
No Matches
Loki.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "connection/Http.hpp"
4
5#include <spdlog/details/null_mutex.h>
6#include <spdlog/sinks/base_sink.h>
7
8#include <mutex>
9#include <string>
10#include <vector>
11
12namespace spdlog::sinks
13{
14 // NOLINTBEGIN
24 template <typename Mutex> class loki_api_sink : public base_sink<Mutex> {
25 public:
31 explicit loki_api_sink(const std::string &lokiAddress);
32
37
38 protected:
47 void sink_it_(const details::log_msg &msg) override;
48
55 void flush_() override;
56
57 private:
58 bool _lokiAvailable{false};
59 std::unique_ptr<HTTP> _connHandler;
60 std::string _basicInformation;
61
62 struct logInfo_t {
63 std::string level;
64 std::vector<std::pair<std::string, std::string>> logs;
65 };
66 std::vector<struct logInfo_t> _internalLogBuffer;
67 };
68
71 // NOLINTEND
72} // namespace spdlog::sinks
std::unique_ptr< HTTP > _connHandler
Definition Loki.hpp:59
void flush_() override
Definition Loki.cpp:81
std::vector< struct logInfo_t > _internalLogBuffer
Definition Loki.hpp:66
void sink_it_(const details::log_msg &msg) override
Definition Loki.cpp:66
std::string _basicInformation
Definition Loki.hpp:60
loki_api_sink(const std::string &lokiAddress)
Definition Loki.cpp:19
std::vector< std::pair< std::string, std::string > > logs
Definition Loki.hpp:64