Skip to content

Instantly share code, notes, and snippets.

@pixelbrackets
Last active Aug 30, 2021
Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@pixelbrackets 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