本文整理汇总了Python中config.Configuration.rollbar_sizes_settings方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.rollbar_sizes_settings方法的具体用法?Python Configuration.rollbar_sizes_settings怎么用?Python Configuration.rollbar_sizes_settings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类config.Configuration
的用法示例。
在下文中一共展示了Configuration.rollbar_sizes_settings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: assure_path_exists
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import rollbar_sizes_settings [as 别名]
else:
print "Unknown command"
sys.exit(2)
def assure_path_exists(path="~/dredd_logs"):
path = os.path.expanduser(path)
if not os.path.exists(path):
os.makedirs(path)
return path
if __name__ == "__main__":
# Log to rotating file
logger = logging.getLogger('dredd')
logger.setLevel(logging.INFO)
log_file = assure_path_exists("~/dredd_logs") + "/current.log"
file_handeler = TimedRotatingFileHandler(log_file, when="midnight", utc=True)
log_format = logging.Formatter('%(levelname)s %(asctime)s: %(message)s')
file_handeler.setFormatter(log_format)
logger.addHandler(file_handeler)
# Log only critical errors to Rollbar
configuration = Configuration()
rollbar.init(configuration.rollbar_api_token, 'production', locals=configuration.rollbar_sizes_settings())
rollbar_handler = RollbarHandler()
rollbar_handler.setLevel(logging.ERROR)
logger.addHandler(rollbar_handler)
main(logger)