File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -16,4 +16,36 @@ public function format(array $record)
1616 $ output = parent ::format ($ record );
1717 return rtrim ($ output ) . "\n" ;
1818 }
19+
20+ protected function convertToString ($ data )
21+ {
22+ $ decoded = is_json ($ data , true );
23+ if ($ decoded ) {
24+ $ data = $ decoded ;
25+ }
26+
27+ if (is_string ($ data )) {
28+ return $ data ;
29+ }
30+
31+ return var_export ($ data , true );
32+ }
33+ }
34+
35+
36+
37+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
38+ function is_json ($ string , $ return = false )
39+ {
40+ if (!is_string ($ string )) {
41+ return false ;
42+ }
43+
44+ $ data = json_decode ($ string );
45+ if (json_last_error () != JSON_ERROR_NONE ) {
46+ return false ;
47+ }
48+
49+ return ($ return ? $ data : true );
1950}
51+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
You can’t perform that action at this time.
0 commit comments