diff --git a/sentry_logger/__init__.py b/sentry_logger/__init__.py index 9c8c23e69..c1c2142cd 100644 --- a/sentry_logger/__init__.py +++ b/sentry_logger/__init__.py @@ -26,6 +26,8 @@ import cgitb from openerp.tools import config from openerp.addons.web.controllers.main import Session +_DEFAULT_LOGGING_LEVEL = logging.ERROR + try: from .odoo_sentry_client import OdooClient from .odoo_sentry_handler import OdooSentryHandler @@ -40,12 +42,17 @@ try: cgitb.enable() # Get DSN info from config file or ~/.openerp_serverrc (recommended) dsn = config.get('sentry_dsn') + level = config.get('sentry_logging_level') + if not level: + level = _DEFAULT_LOGGING_LEVEL + else: + level = eval(level) # Create Client client = OdooClient( dsn=dsn, processors=processors, ) - handler = OdooSentryHandler(client, level=logging.ERROR) + handler = OdooSentryHandler(client, level=level) root_logger.addHandler(handler) else: root_logger.warn(u"Sentry DSN not defined in config file") diff --git a/sentry_logger/__openerp__.py b/sentry_logger/__openerp__.py index ea9fe08c0..43bb13fc5 100644 --- a/sentry_logger/__openerp__.py +++ b/sentry_logger/__openerp__.py @@ -27,12 +27,18 @@ 'description': """ Sentry ====== - Integration with Sentry Error reporting engine. -Insert sentry DSN to ~/.openerp_serverrc with value: - sentry_dsn = sync+ - +Settings: +--------- +You have to add extra parametesr in your odoo config file (~/.openerp_serverrc) + * mandatory parameters: + * Insert sentry DSN with value: + sentry_dsn = sync+ + * optional parameters: + * Define the level of log sent to sentry: + sentry_logging_level = logging.WARNING + (by default loggin.ERROR) Optional Dependencies ---------------------