-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.php
More file actions
48 lines (40 loc) · 1.04 KB
/
test.php
File metadata and controls
48 lines (40 loc) · 1.04 KB
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
39
40
41
42
43
44
45
46
47
48
<?php
require_once 'loggr.php';
// creating class for using fluent syntax
$loggr = new Loggr("myfirstlog", "db961642e48e48e4ab00ef60c90fa29e");
// create a simple event
$loggr->Events->Create()
->Text("Simple fluent event")
->Post();
// more complex event
$world = "World";
$loggr->Events->Create()
->TextF("hello%s", $world)
->Tags("tag1 tag2 tag3")
->Link("http://google.com")
->Source("dave")
->Data("foobar")
->Value(3)
->Geo(-14.456, 73.6879)
->Post();
// trace a variable
$var = "TEST VAR";
$loggr->Events->CreateFromVariable($var)
->Text("Tracing TEST VAR")
->Post();
// trace an exception
try {
$error = 'Always throw this error';
throw new Exception($error);
} catch (Exception $e) {
$loggr->Events->CreateFromException($e)
->Text("Exception")
->Post();
}
// alternatively you can use a non-fluent syntax
$client = new LogClient("myfirstlog", "db961642e48e48e4ab00ef60c90fa29e");
// create a simple event
$ev = new Event();
$ev->Text = "Simple non-fluent event";
$client->Post($ev);
?>