Logging

Coaster can help your application log errors at run-time. Initialize with coaster.logging.init_app().

class coaster.logging.LocalVarFormatter(fmt=None, datefmt=None)[source]

Custom log formatter that logs the contents of local variables in the stack frame.

coaster.logging.configure(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 (default error.log)
  • ADMINS: List of email addresses of admins who will be mailed error reports
  • MAIL_DEFAULT_SENDER: From address of email. Can be an address or a tuple with name and address
  • MAIL_SERVER: SMTP server to send with (default localhost)
  • MAIL_USERNAME and MAIL_PASSWORD: SMTP credentials, if required
coaster.logging.init_app(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 (default error.log)
  • ADMINS: List of email addresses of admins who will be mailed error reports
  • MAIL_DEFAULT_SENDER: From address of email. Can be an address or a tuple with name and address
  • MAIL_SERVER: SMTP server to send with (default localhost)
  • MAIL_USERNAME and MAIL_PASSWORD: SMTP credentials, if required

Related Topics

This Page