Browse Source

[IMP] logging level is not customizable;

pull/99/head
Sylvain LE GAL 10 years ago
parent
commit
6933c3cda0
  1. 9
      sentry_logger/__init__.py
  2. 14
      sentry_logger/__openerp__.py

9
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")

14
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+<Your Sentry DSN>
Settings:
---------
You have to add extra parametesr in your odoo config file (~/.openerp_serverrc)
* mandatory parameters:
* Insert sentry DSN with value:
sentry_dsn = sync+<Your Sentry DSN>
* optional parameters:
* Define the level of log sent to sentry:
sentry_logging_level = logging.WARNING
(by default loggin.ERROR)
Optional Dependencies
---------------------

Loading…
Cancel
Save