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
133
134 // Init
136
137 // Tags
138 sentry_set_tag("compiler.name", COMPILER_NAME);
139 sentry_set_tag("compiler.version", COMPILER_VERSION);
140 sentry_set_tag("build", BUILD_TYPE);
141
142 /* ################################################################################### */
143 /* ############################# MAKE MODIFICATIONS HERE ############################# */
144 /* ################################################################################### */
145
146 /* ################################################################################### */
147 /* ################################ END MODIFICATIONS ################################ */
148 /* ################################################################################### */
149
153 }

◆ ~sentry_api_sink()

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

Destroys the Sentry API sink.

Definition at line 155 of file Sentry.cpp.

155{ 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 188 of file Sentry.cpp.

189 {
190 // Sentry library handles all operations, so no need to flush
191 }

◆ 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 157 of file Sentry.cpp.

158 {
159 if (!_sentryAvailable)
160 {
161 return;
162 }
163 switch (msg.level)
164 {
167 SENTRY_LEVEL_WARNING, "main", std::string(msg.payload.data(), msg.payload.size()).c_str()));
168 break;
171 SENTRY_LEVEL_ERROR, "main", std::string(msg.payload.data(), msg.payload.size()).c_str()));
172 break;
175 SENTRY_LEVEL_FATAL, "main", std::string(msg.payload.data(), msg.payload.size()).c_str()));
176 break;
181 // For lower levels, do nothing for now. But you can easily handle them here.
182 break;
183 default:
184 break;
185 }
186 }

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: