2014-12-24 09:40:41 +01:00
|
|
|
<?php
|
|
|
|
namespace Framadate\Services;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This service provides a standard way to log some informations.
|
|
|
|
*
|
|
|
|
* @package Framadate\Services
|
|
|
|
*/
|
|
|
|
class LogService {
|
|
|
|
|
2014-12-24 22:42:50 +01:00
|
|
|
private $output;
|
|
|
|
|
|
|
|
function __construct($output) {
|
|
|
|
$this->output = $output;
|
|
|
|
}
|
|
|
|
|
2014-12-24 23:38:44 +01:00
|
|
|
/**
|
|
|
|
* Log a message to the log file.
|
|
|
|
*
|
|
|
|
* @param $tag string A tag is used to quickly found a message when reading log file
|
|
|
|
* @param $message string some message
|
|
|
|
*/
|
2014-12-24 22:42:50 +01:00
|
|
|
function log($tag, $message) {
|
2014-12-25 00:55:52 +01:00
|
|
|
error_log(date('H:i:s d/m/Y:') . '[' . $tag . '] ' . $message . "\n", 3, $this->output);
|
2014-12-24 09:40:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|