holabs/logger

User logging for Nette framework

1.0.3 2020-04-27 06:56 UTC

This package is auto-updated.

Last update: 2024-10-27 16:29:09 UTC


README

Easy logging class for maps user's/system activity or debugging.

Logging:

  • action (Defined by developer)
  • parameters (Defined by developer)
  • REMOTE_ADDRESS (auto)
  • User-Agent (auto)
  • User ID (auto if logged in)

Installation

Requirements:

Optional:

composer require holabs/logger
composer require nette/database	# optional
composer require tracy/tracy	# optional

Configuration

extensions:
	holabs.logger: Holabs\Logger\Bridges\Nette\LoggerExtension
	
tracy:
	bar:
		- Holabs\Logger\Bridges\Tracy\LoggerPanel

# Optional if you want to persist(or change for your own storage) your logs over nette database
services:
	# Holabs\Logger\Storages\IStorage
	holabs.logger.storage: Holabs\Logger\Storages\NetteDatabaseStorage('tablename')

You can choose your storage or use predefined.

Using

Your BasePresenter or some component now can looks like this:

<?php

namespace App\Presenters;

use Holabs\Logger\TLogger;
use Nette\Application\UI\Presenter;


abstract class BasePresenter extends Presenter {

	// Inject property $logger and create LOG method
	use TLogger;

	public function startup() {
		parent::startup();

		$this->log('test', ['testing']);
	}

}