2017 © Pedro Peláez
 

project log4p

implementation of log for php

image

log4p/log4p

implementation of log for php

  • Thursday, July 6, 2017
  • by Destiny
  • Repository
  • 0 Watchers
  • 1 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 2 Versions
  • 8 % Grown

The README.md

Log4p

Implementation of log for php, (*1)

Install

Via Composer, (*2)

``` bash $ composer require log4p/log4p, (*3)


## Usage ``` php // use default config $logger = LoggerFactory::getLogger(__CLASS__); $logger->info("This is a log info.", ['paramKey1'=>'paramValue1','paramKey2'=>'paramValue2']); // use custom config LoggerFactory::setConfigs(dirname(__DIR__).'/config/myconfig.php'); $logger = LoggerFactory::getLogger(__CLASS__); $logger->info("This is a custom log info.", ['paramKey1'=>'paramValue1','paramKey2'=>'paramValue2']);

Config

``` php <?php, (*4)

return [, (*5)

/*
|--------------------------------------------------------------------------
| Configuration for log4p
|--------------------------------------------------------------------------
|
| timezone 
*/
'timezone' => "Asia/Shanghai",

/*
|--------------------------------------------------------------------------
| Configuration for log4p
|--------------------------------------------------------------------------
|
| key : filename
| value : [
|   namespace: '*' matching all classes.
|   filePath: a file path to store the log.
|   filenameFormat: a log file name format.
|   contentFormat: a log content format.
| ]
*/
'rule' => [
    'sysout' => [
        'namespace' => '*',
        'filePath' => dirname(__DIR__).'/logs/sysout.log',
        'filenameFormat' => [
            'filename' => '{filename}-{date}',
            'date' => 'Ymd'
        ],
        'contentFormat' => [
            'content' => "[%datetime%] %level_name% - #className#: %message% %context% %extra%\n",
            'date' => 'Y-m-d H:i:s'
        ]
    ],
    'log4p' => [
        'namespace' => 'Log4p',
        'filePath' => dirname(__DIR__).'/logs/log4p.log',
        'filenameFormat' => [
            'filename' => '{filename}-{date}',
            'date' => 'Ymd'
        ],
        'contentFormat' => [
            'content' => "[%datetime%] %level_name% - #className#: %message% %context% %extra%\n",
            'date' => 'Y-m-d H:i:s'
        ]
    ]
],

];, (*6)


## Testing ``` bash $ phpunit

License

The MIT License (MIT). Please see License File for more information., (*7)

The Versions

06/07 2017

dev-master

9999999-dev

implementation of log for php

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Destiny

06/07 2017

1.0.0

1.0.0.0

implementation of log for php

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Destiny