anroots / kohana-loggly
A Kohana log writer for Loggly.com
Installs: 131
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 1
Type:kohana-module
Requires
- php: >=5.4.0
- composer/installers: *
This package is not auto-updated.
Last update: 2022-02-01 12:23:15 UTC
README
Write Kohana logs to a Loggly.com input. You need an account at loggly.com for this to work. The basic account is free, with quota limits.
Installation
As a Git submodule:
git submodule add git://github.com/anroots/kohana-loggly.git modules/loggly
As a Composer dependency
{ "require": { "anroots/kohana-loggly":"1.*" } }
Activate the module in bootstrap.php
.
<?php Kohana::modules(array( ... 'loggly' => MODPATH.'kohana-loggly', ));
Create a new Loggly input
Create a new input via the loggly.com control panel. The input should be a JSON-enable HTTPS input. The module sends logs to Loggly JSON-encoded; that means you can do some really cool stuff with that data.
Add the log writer after module activation
<?php Kohana::$log->attach(new Log_Loggly('my-input-key'));
You can use the $levels
and $min_level
params of $log->attach
to set restraints on when to log to Loggly:
Kohana::$log->attach(new Log_Loggly('my-input-key'), Log::INFO); // Log only messages starting from level INFO (no DEBUG)
Log some data in your code
<?php Kohana::$log->add(Log::EMERGENCY,'The world will end on :time.',[':time'=>time()+60]);