Last active
August 28, 2017 21:44
-
-
Save spence-man/c7686fb08be306cf5b44a3f8aface774 to your computer and use it in GitHub Desktop.
WordPress Log Function
This file contains 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
######################################################################################################### */ | |
# Custom Log function stored in /chap-press/log/log_helpers.php | |
function log_print(){ | |
$open_log = ""; | |
$open_log = str_repeat("==========",10) . "\n"; | |
$open_log .= "[" . date('d-M-Y H:i:s e') . "]" . ": \n"; | |
$open_log .= "Logged from the wp-config.php file \n"; | |
$open_log .= str_repeat("==========",10) . "\n"; | |
error_log($open_log, 3, __DIR__ . "/../public/wp-content/debug.log"); | |
} | |
######################################################################################################### | |
# In the wp-config.php file | |
<?php | |
... | |
#bottom of file | |
include __DIR__ . "/../log/log_helpers.php"; | |
log_print(); | |
?> | |
######################################################################################################### | |
# Result of Log in /public/wp-content/debug.log | |
==================================================================================================== | |
[28-Aug-2017 21:22:58 UTC]: | |
Logged from the wp-config.php file | |
==================================================================================================== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment