Net::Airbrake - Airbrake Notifier API V3 Client
use Net::Airbrake;
my $airbrake = Net::Airbrake->new(
api_key => 'xxxxxxx',
project_id => 9999999,
);
eval { die 'Oops' };
$airbrake->notify($@);
Net::Airbrake is a client of Airbrake Notifier API V3.
Create a new instance. Valid parameters include:
-
api_key
Required. API Key of your project.
-
project_id
Required. Project ID.
-
environment_name
Optional. The name of environment your application is running. Default value is used $ENV{PLACK_ENV} or 'development'.
-
base_url
Optional. The server base URL to send report. Default is "https://airbrake.io".
Add an error. $error accepts HashRef, Object, string generated by die() or just string message. If you want to send raw error report, use HashRef included following key/value pairs:
-
type
=> StringRequired. Error type.
-
message
=> StringRequired. Error message.
-
backtrace
=> ArrayRef[HashRef]Optional. HashRef can contain followings key/value pairs:
-
file
=> StringFile name an error occurred.
-
line
=> IntegerLine number an error occurred.
-
function
=> StringSubroutine name an error occurred.
-
Return true value if the instance has been added error by add_error().
Send errors added by add_error() to Airbrake. \%option parameter is optional and all key/value pairs of its also optional. You can specify followings to report error details. Valid parameters include:
-
context
=> HashRefContext values of its error.
-
environment
=> HashRefEnvironment variables. Set HTTP Headers on web application as usual.
-
session
=> HashRefSession values. Set your application session parameters.
-
params
=> HashRefRequest parameters. Set HTTP Request parameters on web application as usual.
Shortcut of add_error() and send() combination.
Notifier API V3 - https://help.airbrake.io/kb/api-2/notifier-api-v3
Six Apart, Ltd. [email protected]
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.