Last active
February 27, 2025 20:17
-
-
Save melaniekung/c7479af4f3b3b6c911e58a5779897152 to your computer and use it in GitHub Desktop.
AtoM Loggers
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
function prodlog($message = "", $value = "") | |
{ | |
$logFile = "./log/qubit_prod.log"; | |
if ($value != null) { | |
$logMessage = $message.": "; | |
if (is_string($value)) { | |
count($value) > 0 ? $logMessage .= $value : $logMessage .= 'no value'; | |
} elseif (is_bool($value)) { | |
$logMessage .= $value ? 'true' : 'false'; | |
} else { | |
$logMessage .= json_encode($value); | |
} | |
} else { | |
$logMessage = json_encode($message); | |
} | |
error_log("PROD LOG -- " . $logMessage . "\n", 3, $logFile); | |
} | |
function docklog($message = "", $value = "") | |
{ | |
if ($value != null) { | |
file_put_contents('php://stdout', $message.": "); | |
if (is_string($value)) { | |
file_put_contents('php://stdout', $value); | |
} else if (is_bool($value)) { | |
file_put_contents('php://stdout', $value ? 'true' : 'false'); | |
} else { | |
file_put_contents('php://stdout', json_encode($value)); | |
} | |
} else { | |
file_put_contents('php://stdout', json_encode($message)); | |
} | |
$linebreak = "\n"; | |
file_put_contents('php://stdout', $linebreak); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment