diff options
author | Jim Fulton <jim@jimfulton.info> | 2017-06-07 15:24:59 -0400 |
---|---|---|
committer | Jim Fulton <jim@jimfulton.info> | 2017-06-07 15:24:59 -0400 |
commit | e1fa24f0857525c4c7b46450792ae0548d40e84e (patch) | |
tree | 16ee6765e5e57cff07d2c5b31b9a5b73e6770003 /raven/contrib | |
parent | 11ddffcb3c92212e283a6f424700a4485a8e0504 (diff) | |
download | raven-e1fa24f0857525c4c7b46450792ae0548d40e84e.tar.gz |
Added support for logging integreation via ZConfig:
http://zconfig.readthedocs.io/en/latest/using-logging.html
(Note that the Zope integration also uses ZConfig, but adds lots of
Zope-specific machinery that won't work elsewhere.)
Diffstat (limited to 'raven/contrib')
-rw-r--r-- | raven/contrib/zconfig/__init__.py | 22 | ||||
-rw-r--r-- | raven/contrib/zconfig/component.xml | 25 |
2 files changed, 47 insertions, 0 deletions
diff --git a/raven/contrib/zconfig/__init__.py b/raven/contrib/zconfig/__init__.py new file mode 100644 index 0000000..befbf5f --- /dev/null +++ b/raven/contrib/zconfig/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +""" +raven.contrib.zope +~~~~~~~~~~~~~~~~~~ + +:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details. +:license: BSD, see LICENSE for more details. +""" +import ZConfig.components.logger.factory +import raven.handlers.logging + +class Factory(ZConfig.components.logger.factory.Factory): + + def getLevel(self): + return self.section.level + + def create(self): + return raven.handlers.logging.SentryHandler(**self.section.__dict__) + + def __init__(self, section): + ZConfig.components.logger.factory.Factory.__init__(self) + self.section = section diff --git a/raven/contrib/zconfig/component.xml b/raven/contrib/zconfig/component.xml new file mode 100644 index 0000000..4353eb2 --- /dev/null +++ b/raven/contrib/zconfig/component.xml @@ -0,0 +1,25 @@ +<component> + <description> + </description> + + <import package="ZConfig.components.logger" file="abstract.xml"/> + + <sectiontype name="sentry" + datatype="raven.contrib.zconfig.Factory" + implements="ZConfig.logger.handler" + extends="ZConfig.logger.base-log-handler"> + <key name="include_paths" required="no" datatype="string-list"/> + <key name="exclude_paths" required="no" datatype="string-list"/> + <key name="timeout" required="no" datatype="integer"/> + <key name="name" required="no"/> + <key name="auto_log_stacks" required="no" datatype="boolean"/> + <key name="string_max_length" required="no" datatype="integer"/> + <key name="list_max_length" required="no" datatype="integer"/> + <key name="site" required="no"/> + <key name="processors" required="no" datatype="string-list"/> + <key name="project" required="no"/> + <key name="dsn" required="no"/> + <key name="release" required="no"/> + <key name="environment" required="no"/> + </sectiontype> +</component> |