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
|
From e9edc16f45f4205246ae9ed0ce623910a7111dfd Mon Sep 17 00:00:00 2001
From: Johnny Broadway <johnny@johnnybroadway.com>
Date: Mon, 25 May 2015 09:17:40 -0500
Subject: [PATCH] Renamed Null to Ignore for PHP7 compatibility
---
README.md | 2 +-
examples/ignore.php | 9 +++++++++
examples/null.php | 9 ---------
lib/Analog/Handler/Ignore.php | 20 ++++++++++++++++++++
lib/Analog/Handler/Null.php | 3 +++
5 files changed, 33 insertions(+), 10 deletions(-)
create mode 100644 examples/ignore.php
delete mode 100644 examples/null.php
create mode 100644 lib/Analog/Handler/Ignore.php
diff --git a/README.md b/README.md
index a21891b..ee90b5d 100644
--- a/README.md
+++ b/README.md
@@ -25,11 +25,11 @@ with examples for each in the examples folder. These include:
* File - Append messages to a file
* FirePHP - Send messages to [FirePHP](http://www.firephp.org/) browser plugin
* GELF - Send message to the [Graylog2](http://www.graylog2.org/) log management server
+* Ignore - Do nothing
* LevelBuffer - Buffer messages and send only if sufficient error level reached
* Mail - Send email notices
* Mongo - Save to MongoDB collection
* Multi - Send different log levels to different handlers
-* Null - Do nothing
* Post - Send messages over HTTP POST to another machine
* Stderr - Send messages to STDERR
* Syslog - Send messages to syslog
diff --git a/examples/ignore.php b/examples/ignore.php
new file mode 100644
index 0000000..f5f766e
--- /dev/null
+++ b/examples/ignore.php
@@ -0,0 +1,9 @@
+<?php
+
+require '../lib/Analog.php';
+
+Analog::handler (Analog\Handler\Ignore::init ());
+
+Analog::log ('Hellooooooo');
+
+?>
\ No newline at end of file
diff --git a/examples/null.php b/examples/null.php
deleted file mode 100644
index aa24a3b..0000000
--- a/examples/null.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-require '../lib/Analog.php';
-
-Analog::handler (Analog\Handler\Null::init ());
-
-Analog::log ('Hellooooooo');
-
-?>
\ No newline at end of file
diff --git a/lib/Analog/Handler/Ignore.php b/lib/Analog/Handler/Ignore.php
new file mode 100644
index 0000000..57c67b5
--- /dev/null
+++ b/lib/Analog/Handler/Ignore.php
@@ -0,0 +1,20 @@
+<?php
+
+namespace Analog\Handler;
+
+/**
+ * Ignores anything sent to it so you can disable logging.
+ *
+ * Usage:
+ *
+ * Analog::handler (Analog\Handler\Ignore::init ());
+ *
+ * Analog::log ('Log me');
+ */
+class Ignore {
+ public static function init () {
+ return function ($info) {
+ // do nothing
+ };
+ }
+}
\ No newline at end of file
diff --git a/lib/Analog/Handler/Null.php b/lib/Analog/Handler/Null.php
index 00a0017..29254eb 100644
--- a/lib/Analog/Handler/Null.php
+++ b/lib/Analog/Handler/Null.php
@@ -3,6 +3,9 @@
namespace Analog\Handler;
/**
+ * Note: Deprecated because Null is a reserved word in PHP7.
+ * Please use Analog\Handler\Ignore instead.
+ *
* Ignores anything sent to it so you can disable logging.
*
* Usage:
From 69615c0e8b4033169b45d58f778fd3ba638d1d52 Mon Sep 17 00:00:00 2001
From: Johnny Broadway <johnny@johnnybroadway.com>
Date: Mon, 25 May 2015 10:23:49 -0500
Subject: [PATCH] Replaced mention of Null with Ignore
---
lib/Analog/Handler/Multi.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Analog/Handler/Multi.php b/lib/Analog/Handler/Multi.php
index dff0887..332e5ed 100644
--- a/lib/Analog/Handler/Multi.php
+++ b/lib/Analog/Handler/Multi.php
@@ -19,7 +19,7 @@
* Analog::WARNING => Analog\Handler\File::init( 'logs/warnings.log' ),
*
* // Debug and info messages sent here
- * Analog::DEBUG => Analog\Handler\Null::init() // do nothing
+ * Analog::DEBUG => Analog\Handler\Ignore::init() // do nothing
* ) ) );
*
* // will be ignored
|