Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function logToFile($msg) {
- $file = "../cron-log/wrikeSlackTaskIntegration.log";
- if (filesize($file) < 2097152) {
- // If file size more than 2Mb rename this file and create new
- $dateTimePrague = new \DateTime('now', new \DateTimeZone('Europe/Prague'));
- $startDay = file_get_contents($file, false, null, null, 10);
- $newName = substr($file, 0, -4)."_".$startDay."_".$dateTimePrague->format('Y-m-d').".log";
- rename($file, $newName);
- $bla = fopen($file, "w");
- fclose($bla);
- }
- $fd = fopen($file, "a");
- fwrite($fd, $msg . "\n\n");
- fclose($fd);
- }
- logToFile('log message');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement