-
Notifications
You must be signed in to change notification settings - Fork 4
/
example.c
38 lines (28 loc) · 971 Bytes
/
example.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "raven/craven.h"
#include <stdio.h>
int main(void)
{
int ret = craven_init("udp://12345678123456781234567812345678:[email protected]:12340/1", 3);
if (ret) {
printf("craven_init failed\n");
return -1;
}
craven_info("this is message",
"extra.anything", "bla ba da ba da",
NULL);
void* msg = craven_message_new();
craven_message_put(msg, "message", "this is second message");
craven_message_putf(msg, "extra.param", "%d, %d, %d, %d", 123, 120, 112, 102);
craven_message_send(msg);
// custom dsn example
dsn_t dsn = craven_init_dsn("udp://77777777777777777777777777777777:[email protected]:12340/1", 0);
craven_message_send_dsn(dsn, msg);
craven_info_dsn(dsn, "this is message",
"extra.anything", "bla ba da ba da",
NULL);
// dsn object holds pointer to c++ dsn_t object, it should remove before
// destroy
craven_destroy_dsn(dsn);
craven_message_free(msg);
return 0;
}