Skip to content

Enable logging for production debugging. Short helper: l()

php
# General log line
l('test log');

# Example output:
[info] 2019-07-08 07:49:02 /www/app/home/controller/index.php:9 test log
# Default path: ./app/runtime/log/{module}/date(YmdH).log
# e.g. /www/app/runtime/log/home/2019070807.log
# Logs rotate to save space (default retention: one day)

Levels (see \tide\log):

php
FATAL 1 # must fix — can break responses
ERR   2 # serious errors
WARN  3 # potential functional issues
INFO  4 # default level for l()
DEBUG 5 # verbose debugging

Explicit level:

php
l('test log', \tide\log::FATAL);
l('test log', \tide\log::ERR);
l('test log', \tide\log::WARN);
l('test log', \tide\log::INFO);
l('test log', \tide\log::DEBUG);

config.php

php
'log_path'        => '', // empty → ./app/runtime/log/
'log_level'       => 5,  // allow levels ≤ this value
'log_remain_days'  => 1,  // retention in days

PhpTide documentation