Logging

Logs are a very important part of an application, and they come natively in Bear Framework. You can configure automatic error logging and log custom data yourself.

To enable logs just set the 'logsDir' configuration variable to the desired directory where the files will be written.

$app = new BearFramework\App();
$app->config->logsDir = __DIR__ . '/../logs/';

API

BearFramework\App\Logger - Provides logging functionlity
BearFramework\App\Logger::log - Appends data to the file specified. The file will be created if not exists.

Examples

Custom info logging

$app->logger->log('info', 'Visit from 111.222.333.444');

Error logging

Enable error logging by settings 'logErrors' in the application config.

$app = new BearFramework\App();
$app->config->logErrors = true;
Next: Context