-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.php
More file actions
149 lines (122 loc) · 4.55 KB
/
index.php
File metadata and controls
149 lines (122 loc) · 4.55 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHP Log Class - Joey van Ommen - Joeyvo.me</title>
<link rel="stylesheet" media="screen" href="http://joeyvo.me/css/1140.css" />
<link rel="stylesheet" media="screen" href="http://joeyvo.me/stylesheet.css" />
<style type="text/css">
header { margin-top: 50px; }
a, a:visited { color: #07c; }
footer {
text-align: center;
font-size: .8em;
color: #666;
padding: 50px 0px;
font-weight: 300;
}
iframe {
border: 1px solid #f4f4f4;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
h3 { margin-top: 20px; margin-bottom: 10px; }
p { font-size: .9em; }
pre {
background: #eee;
padding: 5px;
font-size: .8em;
margin-bottom: 20px;
}
.log_link, .log_link:visited {
display: block;
color: #07c;
font-size: .7em;
font-weight: 300;
}
.git, .git:visited {
line-height: 60px;
color: #aaa;
font-weight: 300;
text-decoration: none;
}
.git img {
float: left;
margin-right: 10px;
margin-top: 5px;
}
</style>
</head>
<?php
include('vendor/autoload.php');
include('src/class.log.php');
$log = new Log(array('default' =>'example.log', 'secondary' => 'example_two.log'));
$log->clear();
$log->entry($log::SPACER, '** example.log file used for demonstration **', false);
$log->debug($log);
$log->log($log::DEBUG, 'Basic usage introduction');
$log->debug('Debug with context data', array('Your IP', $_SERVER['REMOTE_ADDR']));
$log->notice('Notice with context, without timestamp', array('Context'), false);
$log->warning('Warning without context');
$log->switchTo('secondary');
$log->clear();
// Check out:
$log->entry($log::SPACER, '** Switched to another log file **', false);
$log->alert('Alert, we switched to another log file!');
?>
<body>
<a href="https://github.com/Joeynoh/PHP-Log-Class"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
<div class="container">
<div class="row">
<header class="twelvecol last">
<h1>PHP Log Class <?php echo $log->error; ?></h1>
</header>
</div>
<div class="row">
<section class="twelvecol last">
<iframe src="example.log" width="100%" height="100%"></iframe>
<a class="log_link" href="example.log" title="Log example">Example log file located here</a>
</section>
</div>
<div class="row">
<section class="sixcol">
<h3>About</h3>
<p>This PHP class was written as a light weight, easy-to-use way to log activity to a .log file. It's designed to instantly work within any PHP project, multiple log files and complete freedom with the format of the log entries.</p>
<p>All 8 logging levels defined in
<a href="http://tools.ietf.org/html/rfc5424">RFC 5424</a> are supported (DEBUG, INFO, NOTICE, WARNING,
ERROR, CRITICAL, ALERT, EMERGENCY) and this class implements the <a href="https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md">PSR-3 interface</a>.</p>
<p>Upon refreshing this page, the example log file in the above iframe is cleared and updated with new entries.</p>
<h3>License</h3>
<p>MIT/GPL License</p>
<h3>Follow or Fork</h3>
<a href="https://github.com/Joeynoh/PHP-Log-Class" class="git">
<img src="http://joeyvo.me/HTML5-minesweeper/images/git.jpg" width="48" height="48" alt="Open Source PHP Log class">
Follow this project on Github!
</a>
</section>
<section class="sixcol last">
<h3>Basic Usage</h3>
<p>Create a log instance for one .log file, or multiple:</p>
<pre><code>$log = new Log('example.log');
// OR
$multi_logs = new Log(array(
'default' => 'example.log',
'other' => 'other.log'
));</code></pre>
<p>Add entries to a .log file:</p>
<pre><code>$log->warning('Basic entry, with timestamp');
$log->warning('Entry with context', array('Meta', 'data', 'here'));
$log->log($log::DEBUG, 'Entry with custom level');</code></pre>
<p>Clear the .log file completely (use with caution).</p>
<pre><code>$log->clear();</code></pre>
</section>
</div>
<div class="row">
<footer class="twelvecol last">
by Joey van Ommen - <a href="http://joeyvo.me" title="Joey van Ommen's showcase">joeyvo.me</a> - ©2013
</footer>
</div>
</div>
</body>
</html>