Skip to content

Commit e019083

Browse files
committed
#2 - Fixed syntax error with constants
1 parent d43c6e0 commit e019083

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/TgLog/Log.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
*/
1313
class Log {
1414

15-
public static const NONE = 'none';
16-
public static const DEBUG = 'debug';
17-
public static const INFO = 'info';
18-
public static const WARN = 'warn';
19-
public static const ERROR = 'error';
15+
public const NONE = 'none';
16+
public const DEBUG = 'debug';
17+
public const INFO = 'info';
18+
public const WARN = 'warn';
19+
public const ERROR = 'error';
2020

2121
/** The available log priorities */
2222
protected static $logPriorities;
@@ -35,7 +35,7 @@ class Log {
3535
*/
3636
public static function instance() {
3737
if (self::$logLevel == null) {
38-
self::$logLevel == INFO;
38+
self::$logLevel == self::INFO;
3939
}
4040
if (self::$instance == null) {
4141
self::$instance = new Log();
@@ -109,7 +109,7 @@ public function getStackTrace($excludeFile = NULL) {
109109
* @param mixed $o - an oject to be dumped along with message. An Exception object will cause a stacktrace dump (optional).
110110
*/
111111
public static function debug($s, $o = null) {
112-
self::instance()->log(DEBUG, $s, $o);
112+
self::instance()->log(self::DEBUG, $s, $o);
113113
}
114114

115115
/**
@@ -118,7 +118,7 @@ public static function debug($s, $o = null) {
118118
* @param mixed $o - an oject to be dumped along with message. An Exception object will cause a stacktrace dump (optional).
119119
*/
120120
public static function info($s, $o = null) {
121-
self::instance()->log(INFO, $s, $o);
121+
self::instance()->log(self::INFO, $s, $o);
122122
}
123123

124124
/**
@@ -127,7 +127,7 @@ public static function info($s, $o = null) {
127127
* @param mixed $o - an oject to be dumped along with message. An Exception object will cause a stacktrace dump (optional).
128128
*/
129129
public static function warn($s, $o = null) {
130-
self::instance()->log(WARN, $s, $o);
130+
self::instance()->log(self::WARN, $s, $o);
131131
}
132132

133133
/**
@@ -136,39 +136,39 @@ public static function warn($s, $o = null) {
136136
* @param mixed $o - an oject to be dumped along with message. An Exception object will cause a stacktrace dump (optional).
137137
*/
138138
public static function error($s, $o = null) {
139-
self::instance()->log(ERROR, $s, $o);
139+
self::instance()->log(self::ERROR, $s, $o);
140140
}
141141

142142
/**
143143
* Print stacktrace into debug log, optionally excluding a certain file from trace.
144144
* @param string $excludeFile - the file to be excluded (optional).
145145
*/
146146
public static function debugStackTrace($excludeFile = NULL) {
147-
self::instance()->logStackTrace(DEBUG, $excludeFile);
147+
self::instance()->logStackTrace(self::DEBUG, $excludeFile);
148148
}
149149

150150
/**
151151
* Print stacktrace into info log, optionally excluding a certain file from trace.
152152
* @param string $excludeFile - the file to be excluded (optional).
153153
*/
154154
public static function infoStackTrace($excludeFile = NULL) {
155-
self::instance()->logStackTrace(INFO, $excludeFile);
155+
self::instance()->logStackTrace(self::INFO, $excludeFile);
156156
}
157157

158158
/**
159159
* Print stacktrace into warning log, optionally excluding a certain file from trace.
160160
* @param string $excludeFile - the file to be excluded (optional).
161161
*/
162162
public static function warnStackTrace($excludeFile = NULL) {
163-
self::instance()->logStackTrace(WARN, $excludeFile);
163+
self::instance()->logStackTrace(self::WARN, $excludeFile);
164164
}
165165

166166
/**
167167
* Print stacktrace into error log, optionally excluding a certain file from trace.
168168
* @param string $excludeFile - the file to be excluded (optional).
169169
*/
170170
public static function errorStackTrace($excludeFile = NULL) {
171-
self::instance()->logStackTrace(ERROR, $excludeFile);
171+
self::instance()->logStackTrace(self::ERROR, $excludeFile);
172172
}
173173

174174
/**
@@ -216,7 +216,7 @@ public static function get() {
216216
*/
217217
protected static function isLogLevelIncluded($sev) {
218218
if (self::$logPriorities == null) {
219-
self::$logPriorities = array(NONE, DEBUG, INFO, WARN, ERROR);
219+
self::$logPriorities = array(self::NONE, self::DEBUG, self::INFO, self::WARN, self::ERROR);
220220
}
221221
$logIndex = array_search(self::$logLevel, self::$logPriorities);
222222
$sevIndex = array_search($sev, self::$logPriorities);

0 commit comments

Comments
 (0)