Skip to content

Very simple interface for viewing monolog JSON formatted log files

License

Notifications You must be signed in to change notification settings

RobinBrackez/monolog-viewer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

monolog-viewer

Very simple interface for viewing monolog JSON formatted log files

Basic Usage

<?php
require (__DIR__ . '/vendor/autoload.php');
$viewer = new \Jtclark\MonologViewer([
    'user' => 'user',
    'pass' => 'abc123',
    'path' => 'sample.log',
    'template' => 'optional_log_template.twig'
]);

// commenting out this line will disable authentication
$viewer->authenticate();

$viewer->render();

monolog config

How we initialized Monolog to write our log files.

<?php
$logger = new \Monolog\Logger('app');

$logger->pushProcessor(new \Monolog\Processor\UidProcessor());
$handler = new \Monolog\Handler\StreamHandler('sample.log', \Monolog\Logger::DEBUG);
$handler->setFormatter(new Monolog\Formatter\JsonFormatter());
$logger->pushHandler($handler);

About

Very simple interface for viewing monolog JSON formatted log files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 64.4%
  • HTML 35.6%