Created
August 13, 2020 12:11
-
-
Save graceman9/e4ac52f9c6da2ade877ac337fa2879b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* | |
* Very simple logger, log to console.log(). | |
*/ | |
namespace App; | |
class Logger { | |
public static function log($response) { | |
if (is_object($response) || is_array($response)) { | |
$response = json_encode($response); | |
echo '<script>console.log(JSON.parse(\'' . $response . '\'));</script>'; | |
} | |
else { | |
echo '<script>console.log(\'' . $response . '\');</script>'; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment