Skip to content

Instantly share code, notes, and snippets.

@doganoo
Last active July 3, 2019 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doganoo/ff7740ceb807547c84a7945738728491 to your computer and use it in GitHub Desktop.
Save doganoo/ff7740ceb807547c84a7945738728491 to your computer and use it in GitHub Desktop.
snippets
<?php
$loggggggggger = function ($message): void {
if (is_array($message)) $message = print_r($message, true);
if (is_bool($message)) $message = $message ? "true" : "false";
if ($message instanceof \Exception) $message = $message->getTraceAsString();
$dateTime = (new \DateTime())->format("Y-m-d H:i:s");
file_put_contents("/var/log/application.log", "$dateTime : $message\n\n\n\n", FILE_APPEND);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment