Audacity
3.2.0
libraries
lib-sentry-reporting
SentryRequestBuilder.cpp
Go to the documentation of this file.
1
/*!********************************************************************
2
3
Audacity: A Digital Audio Editor
4
5
@file SentryRequestBuilder.h
6
@brief Define a class to generate the requests to Sentry.
7
8
Dmitry Vedenko
9
**********************************************************************/
10
11
#include "
SentryRequestBuilder.h
"
12
13
#include <chrono>
14
15
namespace
audacity
16
{
17
namespace
sentry
18
{
19
20
const
SentryRequestBuilder
&
audacity::sentry::SentryRequestBuilder::Get
()
21
{
22
static
SentryRequestBuilder
builder;
23
24
return
builder;
25
}
26
27
network_manager::Request
SentryRequestBuilder::CreateRequest
()
const
28
{
29
using namespace
std::chrono;
30
31
const
std::string sentryAuth =
32
std::string(
"Sentry sentry_version=7,sentry_timestamp="
) +
33
std::to_string(
34
duration_cast<seconds>(system_clock::now().time_since_epoch())
35
.count()) +
36
",sentry_client=sentry-audacity/1.0,sentry_key="
+ SENTRY_DSN_KEY;
37
38
network_manager::Request
request(
mUrl
);
39
40
request.
setHeader
(
"Content-Type"
,
"application/json"
);
41
request.
setHeader
(
"X-Sentry-Auth"
, sentryAuth);
42
43
return
request;
44
}
45
46
SentryRequestBuilder::SentryRequestBuilder
()
47
{
48
mUrl
= std::string(
"https://"
) + SENTRY_DSN_KEY +
"@"
+ SENTRY_HOST +
49
"/api/"
+ SENTRY_PROJECT +
"/store/"
;
50
}
51
52
}
// namespace sentry
53
}
// namespace audacity
SentryRequestBuilder.h
Define a class to generate the requests to Sentry.
audacity::network_manager::Request
Definition:
Request.h:28
audacity::network_manager::Request::setHeader
Request & setHeader(const std::string &name, std::string value)
Definition:
Request.cpp:46
audacity::sentry::SentryRequestBuilder
A helper, that creates a correct Request to Sentry.
Definition:
SentryRequestBuilder.h:24
audacity::sentry::SentryRequestBuilder::Get
static const SentryRequestBuilder & Get()
Definition:
SentryRequestBuilder.cpp:20
audacity::sentry::SentryRequestBuilder::mUrl
std::string mUrl
Definition:
SentryRequestBuilder.h:33
audacity::sentry::SentryRequestBuilder::SentryRequestBuilder
SentryRequestBuilder()
Definition:
SentryRequestBuilder.cpp:46
audacity::sentry::SentryRequestBuilder::CreateRequest
network_manager::Request CreateRequest() const
Definition:
SentryRequestBuilder.cpp:27
audacity
Definition:
FileHistory.h:23
Generated by
1.9.3