Created
March 16, 2015 17:33
-
-
Save bgadrian/4798a9a09eee01206d55 to your computer and use it in GitHub Desktop.
PHP Simplest way to log actions
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 | |
//just TEXT log any action, and info about it, like a purchase, use for backup/internal storage | |
//I use this for all types of requests, when dealing with online payments | |
/* LOG */ | |
file_put_contents('logs/'.date('Y.m').'.pay.log','['.$_SERVER['REMOTE_ADDR'].'] '.date('Y.m.d-H:i:s').': Order ID : '.$order_id.', Error : '.$error.', Sum'.$payed_sum.', Transaction : '.$transaction_id.PHP_EOL,FILE_APPEND); | |
//I recommend to keep the comma, for eventual csv reading | |
//automatically creates a single file per month, keeping the logs small | |
//keeps the IP and time stamp in a nice juman form |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment