Logger¶
Coaster can help your application log errors at run-time. Initialize with coaster.logger.init_app().
-
class
coaster.logger.LocalVarFormatter(fmt=None, datefmt=None)[source]¶ Custom log formatter that logs the contents of local variables in the stack frame.
-
class
coaster.logger.SMSHandler(app_name, exotel_sid, exotel_token, exotel_from, twilio_sid, twilio_token, twilio_from, phonenumbers)[source]¶ Custom logging handler to send SMSes to admins
-
coaster.logger.configure(app)¶ Enables logging for an app using
LocalVarFormatter.This function requires an app that has already been configured (perhaps using
coaster.app.init_app()). It checks for the following configuration parameters:LOGFILE: Name of the file to log to (defaulterror.log)ADMINS: List of email addresses of admins who will be mailed error reportsMAIL_DEFAULT_SENDER: From address of email. Can be an address or a tuple with name and addressMAIL_SERVER: SMTP server to send with (defaultlocalhost)MAIL_USERNAMEandMAIL_PASSWORD: SMTP credentials, if requiredFLUENTD_SERVER: If specified, will enable logging to fluentd (pending)ADMIN_NUMBERS: List of mobile numbers of admin to send SMS alerts. Requires the following values tooSMS_EXOTEL_SID: Exotel SID for Indian numbersSMS_EXOTEL_TOKEN: Exotel tokenSMS_EXOTEL_FROM: Exotel sender’s numberSMS_TWILIO_SID: Twilio SID for non-Indian numbersSMS_TWILIO_TOKEN: Twilio tokenSMS_TWILIO_FROM: Twilio sender’s number
-
coaster.logger.init_app(app)[source]¶ Enables logging for an app using
LocalVarFormatter.This function requires an app that has already been configured (perhaps using
coaster.app.init_app()). It checks for the following configuration parameters:LOGFILE: Name of the file to log to (defaulterror.log)ADMINS: List of email addresses of admins who will be mailed error reportsMAIL_DEFAULT_SENDER: From address of email. Can be an address or a tuple with name and addressMAIL_SERVER: SMTP server to send with (defaultlocalhost)MAIL_USERNAMEandMAIL_PASSWORD: SMTP credentials, if requiredFLUENTD_SERVER: If specified, will enable logging to fluentd (pending)ADMIN_NUMBERS: List of mobile numbers of admin to send SMS alerts. Requires the following values tooSMS_EXOTEL_SID: Exotel SID for Indian numbersSMS_EXOTEL_TOKEN: Exotel tokenSMS_EXOTEL_FROM: Exotel sender’s numberSMS_TWILIO_SID: Twilio SID for non-Indian numbersSMS_TWILIO_TOKEN: Twilio tokenSMS_TWILIO_FROM: Twilio sender’s number