Last active
December 3, 2025 18:10
-
-
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
| # for servers | |
| function prodlog($message = "", $value = "") | |
| { | |
| $logFile = "./log/qubit_prod.log"; | |
| if ($value != null) { | |
| $logMessage = $message.": "; | |
| if (is_string($value)) { | |
| $value != "" ? $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); | |
| } | |
| # for docker | |
| # add to config/ProjectConfiguration.class.php to use across AtoM codebase | |
| function docklog($message = "", $value = "") | |
| { | |
| if ($value != null) { | |
| file_put_contents("php://stdout", "LOG --- ".$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", "LOG --- ".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