Repo-Init
 
Loading...
Searching...
No Matches
spdlog::sinks::sentry_api_sink< Mutex > Class Template Reference

#include <Sentry.hpp>

Inheritance diagram for spdlog::sinks::sentry_api_sink< Mutex >:
Collaboration diagram for spdlog::sinks::sentry_api_sink< Mutex >:

Public Member Functions

 sentry_api_sink (const std::string &sentryAddress)
 
 ~sentry_api_sink ()
 

Protected Member Functions

void sink_it_ (const details::log_msg &msg) override
 
void flush_ () override
 

Private Attributes

bool _sentryAvailable {false}
 

Detailed Description

template<typename Mutex>
class spdlog::sinks::sentry_api_sink< Mutex >

A sink for sending log messages to a Sentry server.

This sink is used to send log messages to a Sentry server for error tracking and monitoring. It provides an interface for sending log messages and flushing the sink.

Template Parameters
MutexThe type of mutex to use for thread safety.

Definition at line 20 of file Sentry.hpp.

Constructor & Destructor Documentation

◆ sentry_api_sink()

template<typename Mutex>
spdlog::sinks::sentry_api_sink< Mutex >::sentry_api_sink ( const std::string & sentryAddress)
explicit

Constructs a Sentry API sink with the specified Sentry server address.

Parameters
sentryAddressThe address of the Sentry server.

Definition at line 121 of file Sentry.cpp.

122 {
123 if (sentryAddress.empty())
124 {
125 return;
126 }
127 _sentryAvailable = true;
128
129 // Set options
135
136 // Init
138
139 // Tags
140 sentry_set_tag("compiler.name", COMPILER_NAME);
141 sentry_set_tag("compiler.version", COMPILER_VERSION);
142 sentry_set_tag("build", BUILD_TYPE);
143
144 /* ################################################################################### */
145 /* ############################# MAKE MODIFICATIONS HERE ############################# */
146 /* ################################################################################### */
147
148 /* ################################################################################### */
149 /* ################################ END MODIFICATIONS ################################ */
150 /* ################################################################################### */
151
155 }

◆ ~sentry_api_sink()

template<typename Mutex>
spdlog::sinks::sentry_api_sink< Mutex >::~sentry_api_sink ( )

Destroys the Sentry API sink.

Definition at line 157 of file Sentry.cpp.

157{ sentry_close(); }

Member Function Documentation

◆ flush_()

template<typename Mutex>
void spdlog::sinks::sentry_api_sink< Mutex >::flush_ ( )
overrideprotected

Flushes the sink.

This function is called to flush any buffered log messages to the Sentry server.

Definition at line 190 of file Sentry.cpp.

191 {
192 // Sentry library handles all operations, so no need to flush
193 }

◆ sink_it_()

template<typename Mutex>
void spdlog::sinks::sentry_api_sink< Mutex >::sink_it_ ( const details::log_msg & msg)
overrideprotected

Sends the log message to the Sentry server.

This function is called for each log message that needs to be sent to the Sentry server.

Parameters
msgThe log message to be sent.

Definition at line 159 of file Sentry.cpp.

160 {
161 if (!_sentryAvailable)
162 {
163 return;
164 }
165 switch (msg.level)
166 {
169 SENTRY_LEVEL_WARNING, "main", std::string(msg.payload.data(), msg.payload.size()).c_str()));
170 break;
173 SENTRY_LEVEL_ERROR, "main", std::string(msg.payload.data(), msg.payload.size()).c_str()));
174 break;
177 SENTRY_LEVEL_FATAL, "main", std::string(msg.payload.data(), msg.payload.size()).c_str()));
178 break;
183 // For lower levels, do nothing for now. But you can easily handle them here.
184 break;
185 default:
186 break;
187 }
188 }

Member Data Documentation

◆ _sentryAvailable

template<typename Mutex>
bool spdlog::sinks::sentry_api_sink< Mutex >::_sentryAvailable {false}
private

Flag indicating if the Sentry server is available.

Definition at line 52 of file Sentry.hpp.

52{false};

The documentation for this class was generated from the following files: