本文整理汇总了Python中raven.conf.setup_logging函数的典型用法代码示例。如果您正苦于以下问题:Python setup_logging函数的具体用法?Python setup_logging怎么用?Python setup_logging使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setup_logging函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, app, client, logging=False):
self.app = app
self.client = client
self.logging = logging
if self.logging:
setup_logging(SentryHandler(self.client))
self.app.sentry = self
开发者ID:1Anastaska,项目名称:raven-python,代码行数:7,代码来源:__init__.py
示例2: start_manager
def start_manager():
if config.SENTRY_DSN:
handler = SentryHandler(config.SENTRY_DSN)
setup_logging(handler)
r = redis.StrictRedis(host=config.REDIS_HOST, port=config.REDIS_PORT, db=config.REDIS_DB)
manager = BotManager(BotificoBot)
while True:
result = r.lpop("queue_message")
if result:
m = json.loads(result)
if m["type"] == "message":
channel = m["channel"]
payload = m["payload"]
manager.send_message(
Network(
host=channel["host"],
port=channel["port"],
ssl=channel["ssl"],
password=channel.get("password", None),
),
Channel(channel=channel["channel"], password=channel.get("channel_password", None)),
payload["msg"],
)
gevent.sleep(0.1)
开发者ID:N3X15,项目名称:notifico,代码行数:28,代码来源:__init__.py
示例3: initialize_raven
def initialize_raven(config):
client_dsn = config.get('sentry_client_dsn', '').strip()
enabled = config.get('sentry_enabled', True)
report_user_errors = config.get('sentry_report_user_errors', False)
include_extra_context = config.get('sentry_include_context', True)
level = config.get('sentry_logging_level', DEFAULT_LOG_LEVEL)
environment = config.get('sentry_environment')
auto_log_stacks = config.get('sentry_auto_log_stacks', False)
odoo_dir = config.get('sentry_odoo_dir')
client = Client(
client_dsn,
install_sys_hook=False,
release=get_odoo_commit(odoo_dir),
environment=environment,
auto_log_stacks=auto_log_stacks,
)
if level not in LOG_LEVEL_MAP:
level = DEFAULT_LOG_LEVEL
if enabled:
handler = OdooSentryHandler(
include_extra_context,
client=client,
level=LOG_LEVEL_MAP[level],
)
if not report_user_errors:
handler.addFilter(UserErrorFilter())
setup_logging(handler)
return client
开发者ID:HBEE,项目名称:odoo_sentry,代码行数:32,代码来源:__init__.py
示例4: start_manager
def start_manager():
if config.SENTRY_DSN:
handler = SentryHandler(config.SENTRY_DSN)
setup_logging(handler)
r = redis.StrictRedis(
host=config.REDIS_HOST,
port=config.REDIS_PORT,
db=config.REDIS_DB
)
manager = BotManager(BotificoBot)
while True:
result = r.lpop('queue_message')
if result:
m = json.loads(result)
if m['type'] == 'message':
channel = m['channel']
payload = m['payload']
manager.send_message(
Network(
host=channel['host'],
port=channel['port'],
ssl=channel['ssl'],
password=channel.get('password', None)
),
Channel(
channel=channel['channel'],
password=channel.get('channel_password', None)
),
payload['msg']
)
gevent.sleep(0.1)
开发者ID:CompanyOnTheWorld,项目名称:notifico,代码行数:35,代码来源:__init__.py
示例5: create_app
def create_app(config={}, testing=False):
from gioland import auth
from gioland import parcel
from gioland import warehouse
from gioland import utils
app = flask.Flask(__name__)
app.config.update(copy.deepcopy(default_config))
if testing:
app.config['TESTING'] = True
else:
app.config.update(configuration_from_environ())
app.config.update(config)
warehouse.initialize_app(app)
auth.register_on(app)
parcel.register_on(app)
register_monitoring_views(app)
utils.initialize_app(app)
sentry_dsn = app.config.get('SENTRY_DSN')
if sentry_dsn:
from raven.conf import setup_logging
from raven.handlers.logging import SentryHandler
setup_logging(SentryHandler(sentry_dsn, level=logging.WARN))
return app
开发者ID:eea,项目名称:gioland,代码行数:25,代码来源:manage.py
示例6: create_app
def create_app():
app = Moxie(__name__)
configurator = Configurator(app)
cfg_path = path.join(app.root_path, 'default_settings.yaml')
configurator.from_yaml(cfg_path)
configurator.from_envvar('MOXIE_SETTINGS', silent=True)
# logging configuration for Raven/Sentry
if raven_available and 'SENTRY_DSN' in app.config:
sentry = Sentry(dsn=app.config['SENTRY_DSN'])
# capture uncaught exceptions within Flask
sentry.init_app(app)
handler = SentryHandler(app.config['SENTRY_DSN'],
level=logging.getLevelName(
app.config.get('SENTRY_LEVEL', 'WARNING')))
setup_logging(handler)
statsd.init_app(app)
cache.init_app(app)
db.init_app(app)
# Static URL Route for API Health checks
app.add_url_rule('/_health', view_func=check_services)
app.add_url_rule('/', view_func=RootView.as_view('root'))
return app
开发者ID:ox-it,项目名称:moxie,代码行数:25,代码来源:__init__.py
示例7: init_app
def init_app(self, app, dsn=None, logging=None, level=None, wrap_wsgi=None, register_signal=None):
if dsn is not None:
self.dsn = dsn
if level is not None:
self.level = level
if wrap_wsgi is not None:
self.wrap_wsgi = wrap_wsgi
if register_signal is not None:
self.register_signal = register_signal
if logging is not None:
self.logging = logging
if not self.client:
self.client = make_client(self.client_cls, app, self.dsn)
if self.logging:
setup_logging(SentryHandler(self.client, level=self.level))
if self.wrap_wsgi:
app.wsgi_app = SentryMiddleware(app.wsgi_app, self.client)
app.before_request(self.before_request)
if self.register_signal:
got_request_exception.connect(self.handle_exception, sender=app)
request_finished.connect(self.add_sentry_id_header, sender=app)
if not hasattr(app, "extensions"):
app.extensions = {}
app.extensions["sentry"] = self
开发者ID:inspirehep,项目名称:raven-python,代码行数:34,代码来源:flask.py
示例8: install
def install():
from nexel.config.settings import Settings
from nexel.handlers import dispatcher
from tornado import version_info
if version_info[0] >= 3:
import tornado.log
tornado.log.enable_pretty_logging()
else:
import tornado.options
tornado.options.enable_pretty_logging()
# global logging level
if Settings()['debug']:
logging.getLogger().setLevel(logging.DEBUG)
else:
logging.getLogger().setLevel(logging.INFO)
# webapp
import tornado.web
web_app = tornado.web.Application(dispatcher, debug=Settings()['debug'],
log_function=webapp_log)
web_app.listen(Settings()['server_port'])
# sentry logging
if Settings()['sentry-api-key']:
web_app.sentry_client = AsyncSentryClient(Settings()['sentry-api-key'])
setup_logging(SentryHandler(Client(Settings()['sentry-api-key'])))
return web_app
开发者ID:AustralianSynchrotron,项目名称:nexel,代码行数:29,代码来源:webapp.py
示例9: setup_sentry
def setup_sentry(dsn=None):
"""Configures the Sentry logging handler.
Args:
dsn - DSN for the Sentry project.
"""
handler = SentryHandler(dsn, level=logging.ERROR)
setup_logging(handler)
开发者ID:40a,项目名称:aurproxy,代码行数:8,代码来源:util.py
示例10: load_sentry
def load_sentry(self):
if self.clientid == "":
return
self.raven = Client(self.clientid, transport=AioHttpTransport)
self.handler = SentryHandler(self.raven)
setup_logging(self.handler)
log.debug("Sentry handler activated.")
开发者ID:ewanxdd,项目名称:Squid-Plugins,代码行数:8,代码来源:sentryio.py
示例11: sentry_handler
def sentry_handler(self):
"""Sentry log handler."""
if self.sentry_client:
from raven.conf import setup_logging
from raven.handlers.logging import SentryHandler
handler = SentryHandler(self.sentry_client)
setup_logging(handler)
return handler
开发者ID:dimazest,项目名称:fowler.corpora,代码行数:9,代码来源:dispatcher.py
示例12: init_app
def init_app(self, app):
self.app = app
if not self.client:
self.client = make_client(self.client_cls, app, self.dsn)
if self.logging:
setup_logging(SentryHandler(self.client))
got_request_exception.connect(self.handle_exception, sender=app, weak=False)
开发者ID:Polychart,项目名称:raven,代码行数:9,代码来源:__init__.py
示例13: init_app
def init_app(self, app, dsn=None, logging=None, level=None,
logging_exclusions=None, wrap_wsgi=None,
register_signal=None):
if dsn is not None:
self.dsn = dsn
if level is not None:
self.level = level
if wrap_wsgi is not None:
self.wrap_wsgi = wrap_wsgi
elif self.wrap_wsgi is None:
# Fix https://github.com/getsentry/raven-python/issues/412
# the gist is that we get errors twice in debug mode if we don't do this
if app and app.debug:
self.wrap_wsgi = False
else:
self.wrap_wsgi = True
if register_signal is not None:
self.register_signal = register_signal
if logging is not None:
self.logging = logging
if logging_exclusions is not None:
self.logging_exclusions = logging_exclusions
if not self.client:
self.client = make_client(self.client_cls, app, self.dsn)
if self.logging:
kwargs = {}
if self.logging_exclusions is not None:
kwargs['exclude'] = self.logging_exclusions
handler = SentryHandler(self.client, level=self.level)
setup_logging(handler, **kwargs)
if app.logger.propagate is False:
app.logger.addHandler(handler)
logging_configured.send(
self, sentry_handler=SentryHandler, **kwargs)
if self.wrap_wsgi:
app.wsgi_app = SentryMiddleware(app.wsgi_app, self.client)
app.before_request(self.before_request)
request_finished.connect(self.after_request, sender=app)
if self.register_signal:
got_request_exception.connect(self.handle_exception, sender=app)
if not hasattr(app, 'extensions'):
app.extensions = {}
app.extensions['sentry'] = self
开发者ID:ehfeng,项目名称:raven-python,代码行数:56,代码来源:flask.py
示例14: __init__
def __init__(self, domain, DSN):
from raven.handlers.logging import SentryHandler
from raven.conf import setup_logging
self.domain = domain
self.dsn = DSN
handler = SentryHandler(self.dsn)
setup_logging(handler)
self.logger = logging.getLogger('linkcheck')
开发者ID:kinkerl,项目名称:linkcheck2sentry,代码行数:10,代码来源:linkcheck2sentry.py
示例15: _sentry_handler
def _sentry_handler(sentry_key=None, obci_peer=None):
try:
client = OBCISentryClient(sentry_key, obci_peer=obci_peer, auto_log_stacks=True)
except ValueError as e:
print('logging setup: initializing sentry failed - ', e.args)
return None
handler = SentryHandler(client)
handler.set_name('sentry_handler')
setup_logging(handler)
return handler
开发者ID:mroja,项目名称:openbci,代码行数:10,代码来源:openbci_logging.py
示例16: main
def main():
DEBUG = (os.environ.get('DEBUG') == 'on')
configure_logging(level=logging.DEBUG if DEBUG else logging.INFO)
SENTRY_DSN = os.environ.get('SENTRY_DSN')
if SENTRY_DSN:
from raven.conf import setup_logging
from raven.handlers.logging import SentryHandler
setup_logging(SentryHandler(SENTRY_DSN, level=logging.ERROR))
manager.run()
开发者ID:eea,项目名称:ldaplog,代码行数:11,代码来源:manage.py
示例17: setup_raven
def setup_raven():
'''we setup sentry to get all stuff from our logs'''
pcfg = AppBuilder.get_pcfg()
from raven.handlers.logging import SentryHandler
from raven import Client
from raven.conf import setup_logging
client = Client(pcfg['raven_dsn'])
handler = SentryHandler(client)
# TODO VERIFY THIS -> This is the way to do it if you have a paid account, each log call is an event so this isn't going to work for free accounts...
handler.setLevel(pcfg["raven_loglevel"])
setup_logging(handler)
return client
开发者ID:timeyyy,项目名称:apptools,代码行数:12,代码来源:peasoup.py
示例18: _setup_logger_raven
def _setup_logger_raven(logger_name):
global __RAVEN_INIT
if not __RAVEN_INIT:
from raven import Client
from raven.handlers.logging import SentryHandler
client = Client("https://")
raven_handler = SentryHandler(client)
__RAVEN_INIT = True
from raven.conf import setup_logging
setup_logging(raven_handler)
logger = logging.getLogger(logger_name)
return logger
开发者ID:AlonAzrael,项目名称:disk_treemap,代码行数:13,代码来源:Utils_Base.py
示例19: init
def init(dsn=None):
"""Redirect Scrapy log messages to standard Python logger"""
observer = log.PythonLoggingObserver()
observer.start()
dict_config = settings.get("LOGGING")
if dict_config is not None:
assert isinstance(dict_config, dict)
logging.dictConfig(dict_config)
handler = SentryHandler(dsn)
setup_logging(handler)
开发者ID:atassumer,项目名称:scrapy-sentry,代码行数:13,代码来源:utils.py
示例20: init_app
def init_app(self, app):
self.app = app
if not self.client:
self.client = make_client(self.client_cls, app, self.dsn)
if self.logging:
setup_logging(SentryHandler(self.client))
got_request_exception.connect(self.handle_exception, sender=app)
if not hasattr(app, 'extensions'):
app.extensions = {}
app.extensions['sentry'] = self
开发者ID:AstromechZA,项目名称:raven-python,代码行数:13,代码来源:__init__.py
注:本文中的raven.conf.setup_logging函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论