Log::Dispatch::Twilio - Log output via Twilio SMS Message
use Log::Dispatch;
my $logger = Log::Dispatch->new(
outputs => [
[ 'Twilio',
min_level => 'emergency',
account_sid => '<your-twilio-account-sid>',
auth_token => '<your-twilio-auth-token>',
from => '<number-to-send-msg-from>',
to => '<number-to-send-msg-to>',
],
],
);
This module provides a Log::Dispatch
output that sends log messages via
Twilio.
While you probably don't want every logged message from your application to
go out via Twilio, I find it particularly useful to set it up as part of my
Log::Dispatch
configuration for critical/emergency errors. In the event
that something dire happens, I'll receive an SMS message through Twilio right
away.
When adding Twilio output to your Log::Dispatch configuration, the following options are required:
-
account_sid
Your Twilio "Account Sid".
-
auth_token
Your Twilio "Auth Token".
-
from
The telephone number from which the SMS messages will appear to be sent from.
This number must be a number attached to your Twilio account.
-
to
The telephone number to which the SMS messages will be sent to.
-
max_messages (default 1)
Maximum number of SMS messages that can be generated from a single logged item. Defaults to 1.
-
new
Constructor.
Implemented as per the Log::Dispatch::Output interface.
-
log_message
Logs message, by sending it as an SMS message to the configured number via the Twilio API.
Implemented as per the Log::Dispatch::Output interface.
Graham TerMarsch (cpan@howlingfrog.com)
Copyright (C) 2012, Graham TerMarsch. All Rights Reserved.
This is free software, you can redistribute it and/or modify it under the Artistic-2.0 license.