Skip to content

Commit

Permalink
Update Log.php
Browse files Browse the repository at this point in the history
  • Loading branch information
mirarus committed Jul 26, 2021
1 parent 01d05a2 commit 61e9637
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
* @author Ali Güçlü (Mirarus) <[email protected]>
* @link https://github.com/mirarus/bmvc-libs
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version 2.5
* @version 2.6
*/

namespace BMVC\Libs;

use Monolog\Formatter\LineFormatter as MlLineFormatter;
use Monolog\Handler\StreamHandler as MlStreamHandler;
use Monolog\Logger as MlLogger;
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use Exception;
use DateTime;

Expand All @@ -37,7 +37,7 @@ class Log
* @param string $key
* @param string|null $val
*/
public function set(string $key, string $val=null, bool $new=false)
public static function set(string $key, string $val=null, bool $new=false)
{
self::${$key} = $val;
if ($new == true) return new self;
Expand All @@ -46,14 +46,14 @@ public function set(string $key, string $val=null, bool $new=false)
public static function monolog(): void
{
#
$formatter = new MlLineFormatter(MlLineFormatter::SIMPLE_FORMAT, MlLineFormatter::SIMPLE_DATE);
$formatter = new LineFormatter(LineFormatter::SIMPLE_FORMAT, LineFormatter::SIMPLE_DATE);
$formatter->includeStacktraces(true);
#
$file = Dir::implode([Dir::app(self::$dir), 'app.log']);
$stream = new MlStreamHandler($file);
$stream = new StreamHandler($file);
$stream->setFormatter($formatter);
#
$log = new MlLogger(strtoupper(self::$name));
$log = new Logger(strtoupper(self::$name));
$log->pushHandler($stream);

self::$monolog = $log;
Expand Down

0 comments on commit 61e9637

Please sign in to comment.