-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample.php
More file actions
48 lines (36 loc) · 1.16 KB
/
Example.php
File metadata and controls
48 lines (36 loc) · 1.16 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
/**
* Project Name: simple_logger
* File Name: example.php
*/
require_once "../src/SimpleLogger/SimpleConfigs.php";
require_once "../src/SimpleLogger/SimpleLogger.php";
use SimpleLogger\Simple as Simple;
class Example {
private $_log = null;
function __construct() {
$this->_log = Simple::logger();
}
public function firstExampleMethod() {
$this->_log->info( "Message from first method" , array ( "dummy" => "params" ) , __FILE__ , __METHOD__ );
}
public function secondExampleMethod() {
//PHP Error trigger
trigger_error("Dummy Error");
//SimpleLogger error trigger
$this->_log->error( "Message from second method" , array ( "dummy" => "params" ) , __FILE__ , __METHOD__ );
}
public function thirdExampleMethod() {
$this->_log->warning( "Message from third method" , array ( "dummy" => "params" ) , __FILE__ , __METHOD__ );
}
public function fourthExampleMethod() {
//Real use exception with try/catch
try {
throw new Exception( "Dummy Exception" );
} catch ( Exception $exception ) {
$this->_log->exception( $exception , __METHOD__ );
}
//Artificial exception
throw new Exception( "Artificial Exception" );
}
}