![]() |
Blamite Game Engine - blam!
00296.01.12.21.0102.blamite
The core library for the Blamite Game Engine.
|
#include <inttypes.h>
#include <stdbool.h>
#include <stddef.h>
#include <signal.h>
Go to the source code of this file.
Classes | |
union | sentry_value_u |
Represents a sentry protocol value. More... | |
struct | sentry_ucontext_s |
This represents the OS dependent user context in the case of a crash, and can be used to manually capture a crash. More... | |
struct | sentry_uuid_s |
A UUID. More... | |
Macros | |
#define | SENTRY_SDK_NAME "sentry.native" |
sentry-native More... | |
#define | SENTRY_SDK_VERSION "0.3.1" |
#define | SENTRY_SDK_USER_AGENT (SENTRY_SDK_NAME "/" SENTRY_SDK_VERSION) |
#define | SENTRY_API |
#define | SENTRY_EXPERIMENTAL_API SENTRY_API |
#define | sentry_string_free sentry_free |
Legacy function. More... | |
Typedefs | |
typedef union sentry_value_u | sentry_value_t |
typedef enum sentry_level_e | sentry_level_t |
Sentry levels for events and breadcrumbs. More... | |
typedef struct sentry_ucontext_s | sentry_ucontext_t |
This represents the OS dependent user context in the case of a crash, and can be used to manually capture a crash. More... | |
typedef struct sentry_uuid_s | sentry_uuid_t |
A UUID. More... | |
typedef struct sentry_envelope_s | sentry_envelope_t |
typedef struct sentry_options_s | sentry_options_t |
typedef struct sentry_transport_s | sentry_transport_t |
typedef sentry_value_t(* | sentry_event_function_t) (sentry_value_t event, void *hint, void *closure) |
Type of the callback for modifying events. More... | |
Enumerations | |
enum | sentry_value_type_t { SENTRY_VALUE_TYPE_NULL, SENTRY_VALUE_TYPE_BOOL, SENTRY_VALUE_TYPE_INT32, SENTRY_VALUE_TYPE_DOUBLE, SENTRY_VALUE_TYPE_STRING, SENTRY_VALUE_TYPE_LIST, SENTRY_VALUE_TYPE_OBJECT } |
Type of a sentry value. More... | |
enum | sentry_level_e { SENTRY_LEVEL_DEBUG = -1, SENTRY_LEVEL_INFO = 0, SENTRY_LEVEL_WARNING = 1, SENTRY_LEVEL_ERROR = 2, SENTRY_LEVEL_FATAL = 3 } |
Sentry levels for events and breadcrumbs. More... | |
enum | sentry_user_consent_t { SENTRY_USER_CONSENT_UNKNOWN = -1, SENTRY_USER_CONSENT_GIVEN = 1, SENTRY_USER_CONSENT_REVOKED = 0 } |
The state of user consent. More... | |
Functions | |
SENTRY_API void * | sentry_malloc (size_t size) |
The library internally uses the system malloc and free functions to manage memory. More... | |
SENTRY_API void | sentry_free (void *ptr) |
Releases memory allocated from the underlying allocator. More... | |
SENTRY_API void | sentry_value_incref (sentry_value_t value) |
Increments the reference count on the value. More... | |
SENTRY_API void | sentry_value_decref (sentry_value_t value) |
Decrements the reference count on the value. More... | |
SENTRY_API size_t | sentry_value_refcount (sentry_value_t value) |
Returns the refcount of a value. More... | |
SENTRY_API void | sentry_value_freeze (sentry_value_t value) |
Freezes a value. More... | |
SENTRY_API int | sentry_value_is_frozen (sentry_value_t value) |
Checks if a value is frozen. More... | |
SENTRY_API sentry_value_t | sentry_value_new_null (void) |
Creates a null value. More... | |
SENTRY_API sentry_value_t | sentry_value_new_int32 (int32_t value) |
Creates a new 32-bit signed integer value. More... | |
SENTRY_API sentry_value_t | sentry_value_new_double (double value) |
Creates a new double value. More... | |
SENTRY_API sentry_value_t | sentry_value_new_bool (int value) |
Creates a new boolen value. More... | |
SENTRY_API sentry_value_t | sentry_value_new_string (const char *value) |
Creates a new null terminated string. More... | |
SENTRY_API sentry_value_t | sentry_value_new_list (void) |
Creates a new list value. More... | |
SENTRY_API sentry_value_t | sentry_value_new_object (void) |
Creates a new object. More... | |
SENTRY_API sentry_value_type_t | sentry_value_get_type (sentry_value_t value) |
Returns the type of the value passed. More... | |
SENTRY_API int | sentry_value_set_by_key (sentry_value_t value, const char *k, sentry_value_t v) |
Sets a key to a value in the map. More... | |
SENTRY_API int | sentry_value_remove_by_key (sentry_value_t value, const char *k) |
This removes a value from the map by key. More... | |
SENTRY_API int | sentry_value_append (sentry_value_t value, sentry_value_t v) |
Appends a value to a list. More... | |
SENTRY_API int | sentry_value_set_by_index (sentry_value_t value, size_t index, sentry_value_t v) |
Inserts a value into the list at a certain position. More... | |
SENTRY_API int | sentry_value_remove_by_index (sentry_value_t value, size_t index) |
This removes a value from the list by index. More... | |
SENTRY_API sentry_value_t | sentry_value_get_by_key (sentry_value_t value, const char *k) |
Looks up a value in a map by key. More... | |
SENTRY_API sentry_value_t | sentry_value_get_by_key_owned (sentry_value_t value, const char *k) |
Looks up a value in a map by key. More... | |
SENTRY_API sentry_value_t | sentry_value_get_by_index (sentry_value_t value, size_t index) |
Looks up a value in a list by index. More... | |
SENTRY_API sentry_value_t | sentry_value_get_by_index_owned (sentry_value_t value, size_t index) |
Looks up a value in a list by index. More... | |
SENTRY_API size_t | sentry_value_get_length (sentry_value_t value) |
Returns the length of the given map or list. More... | |
SENTRY_API int32_t | sentry_value_as_int32 (sentry_value_t value) |
Converts a value into a 32bit signed integer. More... | |
SENTRY_API double | sentry_value_as_double (sentry_value_t value) |
Converts a value into a double value. More... | |
const SENTRY_API char * | sentry_value_as_string (sentry_value_t value) |
Returns the value as c string. More... | |
SENTRY_API int | sentry_value_is_true (sentry_value_t value) |
Returns true if the value is boolean true. More... | |
SENTRY_API int | sentry_value_is_null (sentry_value_t value) |
Returns true if the value is null. More... | |
SENTRY_API char * | sentry_value_to_json (sentry_value_t value) |
Serialize a sentry value to JSON. More... | |
SENTRY_API sentry_value_t | sentry_value_new_event (void) |
Creates a new empty event value. More... | |
SENTRY_API sentry_value_t | sentry_value_new_message_event (sentry_level_t level, const char *logger, const char *text) |
Creates a new message event value. More... | |
SENTRY_API sentry_value_t | sentry_value_new_breadcrumb (const char *type, const char *message) |
Creates a new breadcrumb with a specific type and message. More... | |
SENTRY_EXPERIMENTAL_API char * | sentry_value_to_msgpack (sentry_value_t value, size_t *size_out) |
Serialize a sentry value to msgpack. More... | |
SENTRY_EXPERIMENTAL_API void | sentry_event_value_add_stacktrace (sentry_value_t event, void **ips, size_t len) |
Adds a stacktrace to an event. More... | |
SENTRY_EXPERIMENTAL_API size_t | sentry_unwind_stack (void *addr, void **stacktrace_out, size_t max_len) |
Unwinds the stack from the given address. More... | |
SENTRY_EXPERIMENTAL_API size_t | sentry_unwind_stack_from_ucontext (const sentry_ucontext_t *uctx, void **stacktrace_out, size_t max_len) |
Unwinds the stack from the given context. More... | |
SENTRY_API sentry_uuid_t | sentry_uuid_nil (void) |
Creates the nil uuid. More... | |
SENTRY_API sentry_uuid_t | sentry_uuid_new_v4 (void) |
Creates a new uuid4. More... | |
SENTRY_API sentry_uuid_t | sentry_uuid_from_string (const char *str) |
Parses a uuid from a string. More... | |
SENTRY_API sentry_uuid_t | sentry_uuid_from_bytes (const char bytes[16]) |
Creates a uuid from bytes. More... | |
SENTRY_API int | sentry_uuid_is_nil (const sentry_uuid_t *uuid) |
Checks if the uuid is nil. More... | |
SENTRY_API void | sentry_uuid_as_bytes (const sentry_uuid_t *uuid, char bytes[16]) |
Returns the bytes of the uuid. More... | |
SENTRY_API void | sentry_uuid_as_string (const sentry_uuid_t *uuid, char str[37]) |
Formats the uuid into a string buffer. More... | |
SENTRY_API void | sentry_envelope_free (sentry_envelope_t *envelope) |
Frees an envelope. More... | |
SENTRY_API sentry_value_t | sentry_envelope_get_event (const sentry_envelope_t *envelope) |
Given an envelope returns the embedded event if there is one. More... | |
SENTRY_API char * | sentry_envelope_serialize (const sentry_envelope_t *envelope, size_t *size_out) |
Serializes the envelope. More... | |
SENTRY_API int | sentry_envelope_write_to_file (const sentry_envelope_t *envelope, const char *path) |
Serializes the envelope into a file. More... | |
SENTRY_API sentry_transport_t * | sentry_transport_new (void(*send_func)(sentry_envelope_t *envelope, void *state)) |
Creates a new transport with an initial send_func . More... | |
SENTRY_API void | sentry_transport_set_state (sentry_transport_t *transport, void *state) |
Sets the transport state . More... | |
SENTRY_API void | sentry_transport_set_free_func (sentry_transport_t *transport, void(*free_func)(void *state)) |
Sets the transport hook to free the transport state . More... | |
SENTRY_API void | sentry_transport_set_startup_func (sentry_transport_t *transport, void(*startup_func)(const sentry_options_t *options, void *state)) |
Sets the transport startup hook. More... | |
SENTRY_API void | sentry_transport_set_shutdown_func (sentry_transport_t *transport, bool(*shutdown_func)(uint64_t timeout, void *state)) |
Sets the transport shutdown hook. More... | |
SENTRY_API void | sentry_transport_free (sentry_transport_t *transport) |
Generic way to free a transport. More... | |
SENTRY_API sentry_transport_t * | sentry_new_function_transport (void(*func)(const sentry_envelope_t *envelope, void *data), void *data) |
Create a new function transport. More... | |
SENTRY_API sentry_options_t * | sentry_options_new (void) |
Creates a new options struct. More... | |
SENTRY_API void | sentry_options_free (sentry_options_t *opts) |
Deallocates previously allocated sentry options. More... | |
SENTRY_API void | sentry_options_set_transport (sentry_options_t *opts, sentry_transport_t *transport) |
Sets a transport. More... | |
SENTRY_API void | sentry_options_set_before_send (sentry_options_t *opts, sentry_event_function_t func, void *data) |
Sets the before send callback. More... | |
SENTRY_API void | sentry_options_set_dsn (sentry_options_t *opts, const char *dsn) |
Sets the DSN. More... | |
const SENTRY_API char * | sentry_options_get_dsn (const sentry_options_t *opts) |
Gets the DSN. More... | |
SENTRY_API void | sentry_options_set_sample_rate (sentry_options_t *opts, double sample_rate) |
Sets the sample rate, which should be a double between 0.0 and 1.0 . More... | |
SENTRY_API double | sentry_options_get_sample_rate (const sentry_options_t *opts) |
Gets the sample rate. More... | |
SENTRY_API void | sentry_options_set_release (sentry_options_t *opts, const char *release) |
Sets the release. More... | |
const SENTRY_API char * | sentry_options_get_release (const sentry_options_t *opts) |
Gets the release. More... | |
SENTRY_API void | sentry_options_set_environment (sentry_options_t *opts, const char *environment) |
Sets the environment. More... | |
const SENTRY_API char * | sentry_options_get_environment (const sentry_options_t *opts) |
Gets the environment. More... | |
SENTRY_API void | sentry_options_set_dist (sentry_options_t *opts, const char *dist) |
Sets the dist. More... | |
const SENTRY_API char * | sentry_options_get_dist (const sentry_options_t *opts) |
Gets the dist. More... | |
SENTRY_API void | sentry_options_set_http_proxy (sentry_options_t *opts, const char *proxy) |
Configures the http proxy. More... | |
const SENTRY_API char * | sentry_options_get_http_proxy (const sentry_options_t *opts) |
Returns the configured http proxy. More... | |
SENTRY_API void | sentry_options_set_ca_certs (sentry_options_t *opts, const char *path) |
Configures the path to a file containing ssl certificates for verification. More... | |
const SENTRY_API char * | sentry_options_get_ca_certs (const sentry_options_t *opts) |
Returns the configured path for ca certificates. More... | |
SENTRY_API void | sentry_options_set_debug (sentry_options_t *opts, int debug) |
Enables or disables debug printing mode. More... | |
SENTRY_API int | sentry_options_get_debug (const sentry_options_t *opts) |
Returns the current value of the debug flag. More... | |
SENTRY_API void | sentry_options_set_require_user_consent (sentry_options_t *opts, int val) |
Enables or disables user consent requirements for uploads. More... | |
SENTRY_API int | sentry_options_get_require_user_consent (const sentry_options_t *opts) |
Returns true if user consent is required. More... | |
SENTRY_API void | sentry_options_set_symbolize_stacktraces (sentry_options_t *opts, int val) |
Enables or disables on-device symbolication of stack traces. More... | |
SENTRY_API int | sentry_options_get_symbolize_stacktraces (const sentry_options_t *opts) |
Returns true if on-device symbolication of stack traces is enabled. More... | |
SENTRY_API void | sentry_options_add_attachment (sentry_options_t *opts, const char *name, const char *path) |
Adds a new attachment to be sent along. More... | |
SENTRY_API void | sentry_options_set_handler_path (sentry_options_t *opts, const char *path) |
Sets the path to the crashpad handler if the crashpad backend is used. More... | |
SENTRY_API void | sentry_options_set_database_path (sentry_options_t *opts, const char *path) |
Sets the path to the Sentry Database Directory. More... | |
SENTRY_API void | sentry_options_set_system_crash_reporter_enabled (sentry_options_t *opts, int enabled) |
Enables forwarding to the system crash reporter. More... | |
SENTRY_API int | sentry_init (sentry_options_t *options) |
Initializes the Sentry SDK with the specified options. More... | |
SENTRY_API void | sentry_shutdown (void) |
Shuts down the sentry client and forces transports to flush out. More... | |
SENTRY_EXPERIMENTAL_API void | sentry_clear_modulecache (void) |
Clears the internal module cache. More... | |
const SENTRY_API sentry_options_t * | sentry_get_options (void) |
Returns the client options. More... | |
SENTRY_API void | sentry_user_consent_give (void) |
Gives user consent. More... | |
SENTRY_API void | sentry_user_consent_revoke (void) |
Revokes user consent. More... | |
SENTRY_API void | sentry_user_consent_reset (void) |
Resets the user consent (back to unknown). More... | |
SENTRY_API sentry_user_consent_t | sentry_user_consent_get (void) |
Checks the current state of user consent. More... | |
SENTRY_API sentry_uuid_t | sentry_capture_event (sentry_value_t event) |
Sends a sentry event. More... | |
SENTRY_EXPERIMENTAL_API void | sentry_handle_exception (const sentry_ucontext_t *uctx) |
Captures an exception to be handled by the backend. More... | |
SENTRY_API void | sentry_add_breadcrumb (sentry_value_t breadcrumb) |
Adds the breadcrumb to be sent in case of an event. More... | |
SENTRY_API void | sentry_set_user (sentry_value_t user) |
Sets the specified user. More... | |
SENTRY_API void | sentry_remove_user (void) |
Removes a user. More... | |
SENTRY_API void | sentry_set_tag (const char *key, const char *value) |
Sets a tag. More... | |
SENTRY_API void | sentry_remove_tag (const char *key) |
Removes the tag with the specified key. More... | |
SENTRY_API void | sentry_set_extra (const char *key, sentry_value_t value) |
Sets extra information. More... | |
SENTRY_API void | sentry_remove_extra (const char *key) |
Removes the extra with the specified key. More... | |
SENTRY_API void | sentry_set_context (const char *key, sentry_value_t value) |
Sets a context object. More... | |
SENTRY_API void | sentry_remove_context (const char *key) |
Removes the context object with the specified key. More... | |
SENTRY_API void | sentry_set_fingerprint (const char *fingerprint,...) |
Sets the event fingerprint. More... | |
SENTRY_API void | sentry_remove_fingerprint (void) |
Removes the fingerprint. More... | |
SENTRY_API void | sentry_set_transaction (const char *transaction) |
Sets the transaction. More... | |
SENTRY_API void | sentry_remove_transaction (void) |
Removes the transaction. More... | |
SENTRY_API void | sentry_set_level (sentry_level_t level) |
Sets the event level. More... | |
SENTRY_EXPERIMENTAL_API void | sentry_start_session (void) |
Starts a new session. More... | |
SENTRY_EXPERIMENTAL_API void | sentry_end_session (void) |
Ends a session. More... | |
#define SENTRY_API |
#define SENTRY_EXPERIMENTAL_API SENTRY_API |
#define SENTRY_SDK_NAME "sentry.native" |
sentry-native
sentry-native is a C client to send events to native from C and C++ applications. It can work together with breakpad/crashpad but also send events on its own.
NOTE on encodings:
Sentry will assume an encoding of UTF-8 for all string data that is captured and being sent to sentry as an Event. All the functions that are dealing with paths will assume an OS-specific encoding, typically ANSI on Windows, UTF-8 macOS, and the locale encoding on Linux; and they provide wchar-compatible alternatives on Windows which are preferred.
#define SENTRY_SDK_USER_AGENT (SENTRY_SDK_NAME "/" SENTRY_SDK_VERSION) |
#define SENTRY_SDK_VERSION "0.3.1" |
#define sentry_string_free sentry_free |
Legacy function.
Alias for sentry_free
.
typedef struct sentry_envelope_s sentry_envelope_t |
typedef sentry_value_t(* sentry_event_function_t) (sentry_value_t event, void *hint, void *closure) |
Type of the callback for modifying events.
typedef enum sentry_level_e sentry_level_t |
Sentry levels for events and breadcrumbs.
typedef struct sentry_options_s sentry_options_t |
typedef struct sentry_transport_s sentry_transport_t |
typedef struct sentry_ucontext_s sentry_ucontext_t |
This represents the OS dependent user context in the case of a crash, and can be used to manually capture a crash.
typedef struct sentry_uuid_s sentry_uuid_t |
A UUID.
typedef union sentry_value_u sentry_value_t |
enum sentry_level_e |
enum sentry_value_type_t |
SENTRY_API void sentry_add_breadcrumb | ( | sentry_value_t | breadcrumb | ) |
Adds the breadcrumb to be sent in case of an event.
SENTRY_API sentry_uuid_t sentry_capture_event | ( | sentry_value_t | event | ) |
Sends a sentry event.
SENTRY_EXPERIMENTAL_API void sentry_clear_modulecache | ( | void | ) |
Clears the internal module cache.
For performance reasons, sentry will cache the list of loaded libraries when capturing events. This cache can get out-of-date when loading or unloading libraries at runtime. It is therefore recommended to call sentry_clear_modulecache
when doing so, to make sure that the next call to sentry_capture_event
will have an up-to-date module list.
SENTRY_EXPERIMENTAL_API void sentry_end_session | ( | void | ) |
Ends a session.
SENTRY_API void sentry_envelope_free | ( | sentry_envelope_t * | envelope | ) |
Frees an envelope.
SENTRY_API sentry_value_t sentry_envelope_get_event | ( | const sentry_envelope_t * | envelope | ) |
Given an envelope returns the embedded event if there is one.
This returns a borrowed value to the event in the envelope.
SENTRY_API char* sentry_envelope_serialize | ( | const sentry_envelope_t * | envelope, |
size_t * | size_out | ||
) |
Serializes the envelope.
The return value needs to be freed with sentry_string_free().
SENTRY_API int sentry_envelope_write_to_file | ( | const sentry_envelope_t * | envelope, |
const char * | path | ||
) |
Serializes the envelope into a file.
path
is assumed to be in platform-specific filesystem path encoding.
Returns 0 on success.
SENTRY_EXPERIMENTAL_API void sentry_event_value_add_stacktrace | ( | sentry_value_t | event, |
void ** | ips, | ||
size_t | len | ||
) |
Adds a stacktrace to an event.
If ips
is NULL the current stacktrace is captured, otherwise len
stacktrace instruction pointers are attached to the event.
SENTRY_API void sentry_free | ( | void * | ptr | ) |
Releases memory allocated from the underlying allocator.
const SENTRY_API sentry_options_t* sentry_get_options | ( | void | ) |
Returns the client options.
This might return NULL if sentry is not yet initialized.
SENTRY_EXPERIMENTAL_API void sentry_handle_exception | ( | const sentry_ucontext_t * | uctx | ) |
Captures an exception to be handled by the backend.
This is safe to be called from a crashing thread and may not return.
SENTRY_API int sentry_init | ( | sentry_options_t * | options | ) |
Initializes the Sentry SDK with the specified options.
This takes ownership of the options. After the options have been set they cannot be modified any more.
SENTRY_API void* sentry_malloc | ( | size_t | size | ) |
The library internally uses the system malloc and free functions to manage memory.
It does not use realloc. The reason for this is that on unix platforms we fall back to a simplistic page allocator once we have encountered a SIGSEGV or other terminating signal as malloc is no longer safe to use. Since we cannot portably reallocate allocations made on the pre-existing allocator we're instead not using realloc.
Note also that after SIGSEGV sentry_free() becomes a noop. Allocates memory with the underlying allocator.
SENTRY_API sentry_transport_t* sentry_new_function_transport | ( | void(*)(const sentry_envelope_t *envelope, void *data) | func, |
void * | data | ||
) |
Create a new function transport.
It is a convenience function which works with a borrowed data
, and will automatically free the envelope, so the user provided function does not need to do that.
This function is deprecated and will be removed in a future version. It is here for backwards compatibility. Users should migrate to the sentry_transport_new
API.
SENTRY_API void sentry_options_add_attachment | ( | sentry_options_t * | opts, |
const char * | name, | ||
const char * | path | ||
) |
Adds a new attachment to be sent along.
path
is assumed to be in platform-specific filesystem path encoding. API Users on windows are encouraged to use sentry_options_add_attachmentw
instead.
SENTRY_API void sentry_options_free | ( | sentry_options_t * | opts | ) |
Deallocates previously allocated sentry options.
const SENTRY_API char* sentry_options_get_ca_certs | ( | const sentry_options_t * | opts | ) |
Returns the configured path for ca certificates.
SENTRY_API int sentry_options_get_debug | ( | const sentry_options_t * | opts | ) |
Returns the current value of the debug flag.
const SENTRY_API char* sentry_options_get_dist | ( | const sentry_options_t * | opts | ) |
Gets the dist.
const SENTRY_API char* sentry_options_get_dsn | ( | const sentry_options_t * | opts | ) |
Gets the DSN.
const SENTRY_API char* sentry_options_get_environment | ( | const sentry_options_t * | opts | ) |
Gets the environment.
const SENTRY_API char* sentry_options_get_http_proxy | ( | const sentry_options_t * | opts | ) |
Returns the configured http proxy.
const SENTRY_API char* sentry_options_get_release | ( | const sentry_options_t * | opts | ) |
Gets the release.
SENTRY_API int sentry_options_get_require_user_consent | ( | const sentry_options_t * | opts | ) |
Returns true if user consent is required.
SENTRY_API double sentry_options_get_sample_rate | ( | const sentry_options_t * | opts | ) |
Gets the sample rate.
SENTRY_API int sentry_options_get_symbolize_stacktraces | ( | const sentry_options_t * | opts | ) |
Returns true if on-device symbolication of stack traces is enabled.
SENTRY_API sentry_options_t* sentry_options_new | ( | void | ) |
Creates a new options struct.
Can be freed with sentry_options_free
.
SENTRY_API void sentry_options_set_before_send | ( | sentry_options_t * | opts, |
sentry_event_function_t | func, | ||
void * | data | ||
) |
Sets the before send callback.
SENTRY_API void sentry_options_set_ca_certs | ( | sentry_options_t * | opts, |
const char * | path | ||
) |
Configures the path to a file containing ssl certificates for verification.
SENTRY_API void sentry_options_set_database_path | ( | sentry_options_t * | opts, |
const char * | path | ||
) |
Sets the path to the Sentry Database Directory.
Sentry will use this path to persist user consent, sessions, and other artifacts in case of a crash. This will also be used by the crashpad backend if it is configured.
The path defaults to .sentry-native
in the current working directory, will be created if it does not exist, and will be resolved to an absolute path inside of sentry_init
.
It is recommended that library users set an explicit absolute path, depending on their apps runtime directory.
path
is assumed to be in platform-specific filesystem path encoding. API Users on windows are encouraged to use sentry_options_set_database_pathw
instead.
SENTRY_API void sentry_options_set_debug | ( | sentry_options_t * | opts, |
int | debug | ||
) |
Enables or disables debug printing mode.
SENTRY_API void sentry_options_set_dist | ( | sentry_options_t * | opts, |
const char * | dist | ||
) |
Sets the dist.
SENTRY_API void sentry_options_set_dsn | ( | sentry_options_t * | opts, |
const char * | dsn | ||
) |
Sets the DSN.
SENTRY_API void sentry_options_set_environment | ( | sentry_options_t * | opts, |
const char * | environment | ||
) |
Sets the environment.
SENTRY_API void sentry_options_set_handler_path | ( | sentry_options_t * | opts, |
const char * | path | ||
) |
Sets the path to the crashpad handler if the crashpad backend is used.
The path defaults to the crashpad_handler
/crashpad_handler.exe
executable, depending on platform, which is expected to be present in the same directory as the app executable.
It is recommended that library users set an explicit handler path, depending on the directory/executable structure of their app.
path
is assumed to be in platform-specific filesystem path encoding. API Users on windows are encouraged to use sentry_options_set_handler_pathw
instead.
SENTRY_API void sentry_options_set_http_proxy | ( | sentry_options_t * | opts, |
const char * | proxy | ||
) |
Configures the http proxy.
SENTRY_API void sentry_options_set_release | ( | sentry_options_t * | opts, |
const char * | release | ||
) |
Sets the release.
SENTRY_API void sentry_options_set_require_user_consent | ( | sentry_options_t * | opts, |
int | val | ||
) |
Enables or disables user consent requirements for uploads.
This disables uploads until the user has given the consent to the SDK. Consent itself is given with sentry_user_consent_give
and sentry_user_consent_revoke
.
SENTRY_API void sentry_options_set_sample_rate | ( | sentry_options_t * | opts, |
double | sample_rate | ||
) |
Sets the sample rate, which should be a double between 0.0
and 1.0
.
Sentry will randomly discard any event that is captured using sentry_capture_event
when a sample rate < 1 is set.
SENTRY_API void sentry_options_set_symbolize_stacktraces | ( | sentry_options_t * | opts, |
int | val | ||
) |
Enables or disables on-device symbolication of stack traces.
This feature can have a performance impact, and is enabled by default on Android. It is usually only needed when it is not possible to provide debug information files for system libraries which are needed for serverside symbolication.
SENTRY_API void sentry_options_set_system_crash_reporter_enabled | ( | sentry_options_t * | opts, |
int | enabled | ||
) |
Enables forwarding to the system crash reporter.
Disabled by default.
This setting only has an effect when using Crashpad on macOS. If enabled, Crashpad forwards crashes to the macOS system crash reporter. Depending on the crash, this may impact the crash time. Even if enabled, Crashpad may choose not to forward certain crashes.
SENTRY_API void sentry_options_set_transport | ( | sentry_options_t * | opts, |
sentry_transport_t * | transport | ||
) |
Sets a transport.
SENTRY_API void sentry_remove_context | ( | const char * | key | ) |
Removes the context object with the specified key.
SENTRY_API void sentry_remove_extra | ( | const char * | key | ) |
Removes the extra with the specified key.
SENTRY_API void sentry_remove_fingerprint | ( | void | ) |
Removes the fingerprint.
SENTRY_API void sentry_remove_tag | ( | const char * | key | ) |
Removes the tag with the specified key.
SENTRY_API void sentry_remove_transaction | ( | void | ) |
Removes the transaction.
SENTRY_API void sentry_remove_user | ( | void | ) |
Removes a user.
SENTRY_API void sentry_set_context | ( | const char * | key, |
sentry_value_t | value | ||
) |
Sets a context object.
SENTRY_API void sentry_set_extra | ( | const char * | key, |
sentry_value_t | value | ||
) |
Sets extra information.
SENTRY_API void sentry_set_fingerprint | ( | const char * | fingerprint, |
... | |||
) |
Sets the event fingerprint.
This accepts a variable number of arguments, and needs to be terminated by a trailing NULL
.
SENTRY_API void sentry_set_level | ( | sentry_level_t | level | ) |
Sets the event level.
SENTRY_API void sentry_set_tag | ( | const char * | key, |
const char * | value | ||
) |
Sets a tag.
SENTRY_API void sentry_set_transaction | ( | const char * | transaction | ) |
Sets the transaction.
SENTRY_API void sentry_set_user | ( | sentry_value_t | user | ) |
Sets the specified user.
SENTRY_API void sentry_shutdown | ( | void | ) |
Shuts down the sentry client and forces transports to flush out.
SENTRY_EXPERIMENTAL_API void sentry_start_session | ( | void | ) |
Starts a new session.
SENTRY_API void sentry_transport_free | ( | sentry_transport_t * | transport | ) |
Generic way to free a transport.
SENTRY_API sentry_transport_t* sentry_transport_new | ( | void(*)(sentry_envelope_t *envelope, void *state) | send_func | ) |
Creates a new transport with an initial send_func
.
SENTRY_API void sentry_transport_set_free_func | ( | sentry_transport_t * | transport, |
void(*)(void *state) | free_func | ||
) |
Sets the transport hook to free the transport state
.
SENTRY_API void sentry_transport_set_shutdown_func | ( | sentry_transport_t * | transport, |
bool(*)(uint64_t timeout, void *state) | shutdown_func | ||
) |
Sets the transport shutdown hook.
This hook will receive a millisecond-resolution timeout; it should return true
in case all the pending envelopes have been sent within the timeout, or false
if the timeout was hit.
SENTRY_API void sentry_transport_set_startup_func | ( | sentry_transport_t * | transport, |
void(*)(const sentry_options_t *options, void *state) | startup_func | ||
) |
Sets the transport startup hook.
SENTRY_API void sentry_transport_set_state | ( | sentry_transport_t * | transport, |
void * | state | ||
) |
Sets the transport state
.
If the state is owned by the transport and needs to be freed, use sentry_transport_set_free_func
to set an appropriate hook.
SENTRY_EXPERIMENTAL_API size_t sentry_unwind_stack | ( | void * | addr, |
void ** | stacktrace_out, | ||
size_t | max_len | ||
) |
Unwinds the stack from the given address.
If the address is given in addr
the stack is unwound form there. Otherwise (NULL is passed) the current instruction pointer is used as start address. The stacktrace is written to stacktrace_out
with upt o max_len
frames being written. The actual number of unwound stackframes is returned.
SENTRY_EXPERIMENTAL_API size_t sentry_unwind_stack_from_ucontext | ( | const sentry_ucontext_t * | uctx, |
void ** | stacktrace_out, | ||
size_t | max_len | ||
) |
Unwinds the stack from the given context.
The stacktrace is written to stacktrace_out
with upt o max_len
frames being written. The actual number of unwound stackframes is returned.
SENTRY_API sentry_user_consent_t sentry_user_consent_get | ( | void | ) |
Checks the current state of user consent.
SENTRY_API void sentry_user_consent_give | ( | void | ) |
Gives user consent.
SENTRY_API void sentry_user_consent_reset | ( | void | ) |
Resets the user consent (back to unknown).
SENTRY_API void sentry_user_consent_revoke | ( | void | ) |
Revokes user consent.
SENTRY_API void sentry_uuid_as_bytes | ( | const sentry_uuid_t * | uuid, |
char | bytes[16] | ||
) |
Returns the bytes of the uuid.
SENTRY_API void sentry_uuid_as_string | ( | const sentry_uuid_t * | uuid, |
char | str[37] | ||
) |
Formats the uuid into a string buffer.
SENTRY_API sentry_uuid_t sentry_uuid_from_bytes | ( | const char | bytes[16] | ) |
Creates a uuid from bytes.
SENTRY_API sentry_uuid_t sentry_uuid_from_string | ( | const char * | str | ) |
Parses a uuid from a string.
SENTRY_API int sentry_uuid_is_nil | ( | const sentry_uuid_t * | uuid | ) |
Checks if the uuid is nil.
SENTRY_API sentry_uuid_t sentry_uuid_new_v4 | ( | void | ) |
Creates a new uuid4.
SENTRY_API sentry_uuid_t sentry_uuid_nil | ( | void | ) |
Creates the nil uuid.
SENTRY_API int sentry_value_append | ( | sentry_value_t | value, |
sentry_value_t | v | ||
) |
Appends a value to a list.
This moves the ownership of the value into the list. The caller does not have to call sentry_value_decref
on it.
SENTRY_API double sentry_value_as_double | ( | sentry_value_t | value | ) |
Converts a value into a double value.
SENTRY_API int32_t sentry_value_as_int32 | ( | sentry_value_t | value | ) |
Converts a value into a 32bit signed integer.
const SENTRY_API char* sentry_value_as_string | ( | sentry_value_t | value | ) |
Returns the value as c string.
SENTRY_API void sentry_value_decref | ( | sentry_value_t | value | ) |
Decrements the reference count on the value.
SENTRY_API void sentry_value_freeze | ( | sentry_value_t | value | ) |
Freezes a value.
SENTRY_API sentry_value_t sentry_value_get_by_index | ( | sentry_value_t | value, |
size_t | index | ||
) |
Looks up a value in a list by index.
If missing a null value is returned. The returned value is borrowed.
SENTRY_API sentry_value_t sentry_value_get_by_index_owned | ( | sentry_value_t | value, |
size_t | index | ||
) |
Looks up a value in a list by index.
If missing a null value is returned. The returned value is owned.
If the caller no longer needs the value it must be released with sentry_value_decref
.
SENTRY_API sentry_value_t sentry_value_get_by_key | ( | sentry_value_t | value, |
const char * | k | ||
) |
Looks up a value in a map by key.
If missing a null value is returned. The returned value is borrowed.
SENTRY_API sentry_value_t sentry_value_get_by_key_owned | ( | sentry_value_t | value, |
const char * | k | ||
) |
Looks up a value in a map by key.
If missing a null value is returned. The returned value is owned.
If the caller no longer needs the value it must be released with sentry_value_decref
.
SENTRY_API size_t sentry_value_get_length | ( | sentry_value_t | value | ) |
Returns the length of the given map or list.
If an item is not a list or map the return value is 0.
SENTRY_API sentry_value_type_t sentry_value_get_type | ( | sentry_value_t | value | ) |
Returns the type of the value passed.
SENTRY_API void sentry_value_incref | ( | sentry_value_t | value | ) |
Increments the reference count on the value.
SENTRY_API int sentry_value_is_frozen | ( | sentry_value_t | value | ) |
Checks if a value is frozen.
SENTRY_API int sentry_value_is_null | ( | sentry_value_t | value | ) |
Returns true
if the value is null.
SENTRY_API int sentry_value_is_true | ( | sentry_value_t | value | ) |
Returns true
if the value is boolean true.
SENTRY_API sentry_value_t sentry_value_new_bool | ( | int | value | ) |
Creates a new boolen value.
SENTRY_API sentry_value_t sentry_value_new_breadcrumb | ( | const char * | type, |
const char * | message | ||
) |
Creates a new breadcrumb with a specific type and message.
Either parameter can be NULL in which case no such attributes is created.
SENTRY_API sentry_value_t sentry_value_new_double | ( | double | value | ) |
Creates a new double value.
SENTRY_API sentry_value_t sentry_value_new_event | ( | void | ) |
Creates a new empty event value.
SENTRY_API sentry_value_t sentry_value_new_int32 | ( | int32_t | value | ) |
Creates a new 32-bit signed integer value.
SENTRY_API sentry_value_t sentry_value_new_list | ( | void | ) |
Creates a new list value.
SENTRY_API sentry_value_t sentry_value_new_message_event | ( | sentry_level_t | level, |
const char * | logger, | ||
const char * | text | ||
) |
Creates a new message event value.
logger
can be NULL to omit the logger value.
SENTRY_API sentry_value_t sentry_value_new_null | ( | void | ) |
Creates a null value.
SENTRY_API sentry_value_t sentry_value_new_object | ( | void | ) |
Creates a new object.
SENTRY_API sentry_value_t sentry_value_new_string | ( | const char * | value | ) |
Creates a new null terminated string.
SENTRY_API size_t sentry_value_refcount | ( | sentry_value_t | value | ) |
Returns the refcount of a value.
SENTRY_API int sentry_value_remove_by_index | ( | sentry_value_t | value, |
size_t | index | ||
) |
This removes a value from the list by index.
SENTRY_API int sentry_value_remove_by_key | ( | sentry_value_t | value, |
const char * | k | ||
) |
This removes a value from the map by key.
SENTRY_API int sentry_value_set_by_index | ( | sentry_value_t | value, |
size_t | index, | ||
sentry_value_t | v | ||
) |
Inserts a value into the list at a certain position.
This moves the ownership of the value into the list. The caller does not have to call sentry_value_decref
on it.
If the list is shorter than the given index it's automatically extended and filled with null
values.
SENTRY_API int sentry_value_set_by_key | ( | sentry_value_t | value, |
const char * | k, | ||
sentry_value_t | v | ||
) |
Sets a key to a value in the map.
This moves the ownership of the value into the map. The caller does not have to call sentry_value_decref
on it.
SENTRY_API char* sentry_value_to_json | ( | sentry_value_t | value | ) |
Serialize a sentry value to JSON.
The string is freshly allocated and must be freed with sentry_string_free
.
SENTRY_EXPERIMENTAL_API char* sentry_value_to_msgpack | ( | sentry_value_t | value, |
size_t * | size_out | ||
) |
Serialize a sentry value to msgpack.
The string is freshly allocated and must be freed with sentry_string_free
. Since msgpack is not zero terminated the size is written to the size_out
parameter.