Skip to content

Instantly share code, notes, and snippets.

@pixelbrackets
Last active August 30, 2021 11:59
Show Gist options
  • Save pixelbrackets/6fd80e9a09154672f06ea5253bba5aa6 to your computer and use it in GitHub Desktop.
Save pixelbrackets/6fd80e9a09154672f06ea5253bba5aa6 to your computer and use it in GitHub Desktop.
Simple PHP log method
<?php
$data = ['foo' => 'Hello World'];
file_put_contents('/tmp/log.txt', time() . ' ' . print_r($data, true) . PHP_EOL, FILE_APPEND);
@pixelbrackets
Copy link
Author

pixelbrackets commented Apr 16, 2018

Simple TYPO3 Temp Logger:

$data = ['foo' => 'Hello World'];
file_put_contents(PATH_site . 'typo3temp/log.txt', time() . ' ' . print_r($data, true) . PHP_EOL, FILE_APPEND);

A more flexible way is to use the TYPO3 logging API, see https://pixelbrackets.de/notes/flexible-logging-with-typo3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment