File tree Expand file tree Collapse file tree 7 files changed +47
-22
lines changed Expand file tree Collapse file tree 7 files changed +47
-22
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,10 @@ class Debug extends Message {
1111 /**
1212 * Constructs the debug.
1313 * @param string $message - the message text.
14+ * @param mixed $data - custom additional data for application specific usage.
1415 */
15- public function __construct ($ message ) {
16- parent ::__construct ('debug ' , $ message );
16+ public function __construct ($ message, $ data = NULL ) {
17+ parent ::__construct ('debug ' , $ message, $ data );
1718 }
1819
19- }
20+ }
Original file line number Diff line number Diff line change @@ -11,9 +11,10 @@ class Error extends Message {
1111 /**
1212 * Constructs the error.
1313 * @param string $message - the message text.
14+ * @param mixed $data - custom additional data for application specific usage.
1415 */
15- public function __construct ($ message ) {
16- parent ::__construct ('error ' , $ message );
16+ public function __construct ($ message, $ data = NULL ) {
17+ parent ::__construct ('error ' , $ message, $ data );
1718 }
1819
19- }
20+ }
Original file line number Diff line number Diff line change @@ -11,9 +11,10 @@ class Info extends Message {
1111 /**
1212 * Constructs the info.
1313 * @param string $message - the message text.
14+ * @param mixed $data - custom additional data for application specific usage.
1415 */
15- public function __construct ($ message ) {
16- parent ::__construct ('info ' , $ message );
16+ public function __construct ($ message, $ data = NULL ) {
17+ parent ::__construct ('info ' , $ message, $ data );
1718 }
1819
19- }
20+ }
Original file line number Diff line number Diff line change 1212 */
1313class Log {
1414
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 ' ;
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 ' ;
20+ public const SUCCESS = 'success ' ;
2021
2122 /** The available log priorities */
2223 protected static $ logPriorities ;
Original file line number Diff line number Diff line change @@ -10,10 +10,12 @@ class Message {
1010
1111 protected $ type ;
1212 protected $ message ;
13+ protected $ data ;
1314
14- public function __construct ($ type , $ message ) {
15+ public function __construct ($ type , $ message, $ data = NULL ) {
1516 $ this ->type = $ type ;
1617 $ this ->message = $ message ;
18+ $ this ->data = $ data ;
1719 }
1820
1921 /**
@@ -31,4 +33,21 @@ public function getType() {
3133 public function getMessage () {
3234 return $ this ->message ;
3335 }
34- }
36+
37+ /**
38+ * Sets the custom additonal data
39+ * @param mixed $data - the data.
40+ */
41+ public function setData ($ data ) {
42+ $ this ->data = $ data ;
43+ return $ this ;
44+ }
45+
46+ /**
47+ * Returns the custom additonal data
48+ * @return mixed the data.
49+ */
50+ public function getData () {
51+ return $ this ->data ;
52+ }
53+ }
Original file line number Diff line number Diff line change @@ -11,9 +11,10 @@ class Success extends Message {
1111 /**
1212 * Constructs the success message.
1313 * @param string $message - the message text.
14+ * @param mixed $data - custom additional data for application specific usage.
1415 */
15- public function __construct ($ message ) {
16- parent ::__construct ('success ' , $ message );
16+ public function __construct ($ message, $ data = NULL ) {
17+ parent ::__construct ('success ' , $ message, $ data );
1718 }
1819
19- }
20+ }
Original file line number Diff line number Diff line change @@ -11,9 +11,10 @@ class Warning extends Message {
1111 /**
1212 * Constructs the warning.
1313 * @param string $message - the message text.
14+ * @param mixed $data - custom additional data for application specific usage.
1415 */
15- public function __construct ($ message ) {
16- parent ::__construct ('warning ' , $ message );
16+ public function __construct ($ message, $ data = NULL ) {
17+ parent ::__construct ('warning ' , $ message, $ data );
1718 }
1819
19- }
20+ }
You can’t perform that action at this time.
0 commit comments