Skip to content

[READ-ONLY]The access log component for Hyperf.

License

Notifications You must be signed in to change notification settings

friendsofhyperf/access-log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Access Log

Latest Stable Version Total Downloads License

The access log component for Hyperf.

Installation

  • Request
composer require friendsofhyperf/access-log
  • Publish
php bin/hyperf.php vendor:publish friendsofhyperf/access-log
  • Add logger group
// config/autoload/logger.php
return [
    // ...
    'access' => [
        'handler' => [
            'class' => \Monolog\Handler\StreamHandler::class,
            'constructor' => [
                'stream' => BASE_PATH . "/runtime/logs/access_log.log",
                'level' => Monolog\Logger::DEBUG,
            ],
        ],
        'formatter' => [
            'class' => \FriendsOfHyperf\AccessLog\Formatter\AccessLogFormatter::class,
        ],
    ],
];
  • Switch logger group
// config/autoload/access_log.php
return [
    'enable' => env('ACCESS_LOG_ENABLE', false),
    'logger' => [
        'group' => 'access',
        'time_format' => 'd/M/Y:H:i:s O',
    ],
    'ignore_user_agents' => [
        'Consul Health Check',
    ],
    'ignore_paths' => [
        '/favicon.ico',
    ],
];

Donate

If you like them, Buy me a cup of coffee. Alipay | WeChat

Contact

License

MIT