serve.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:auth-tool 作者: luciddg 项目源码 文件源码
def make_rotate_logs(self, app):
        # see http://www.cherrypy.org/wiki/Logging#CustomHandlers
        log = app.log

        # Remove the default FileHandlers if present.
        log.error_file = ""
        log.access_file = ""

        maxbytes = getattr(log, "rot_maxBytes", 10485760)
        backupcount = getattr(log, "rot_backupCount", 5)

        # Make a new RotatingFileHandler for the error log.
        fname = getattr(log, "rot_error_file", "error.log")
        h = handlers.RotatingFileHandler(fname, 'a', maxbytes, backupcount)
        h.setLevel(logging.DEBUG)
        h.setFormatter(_cplogging.logfmt)
        log.error_log.addHandler(h)

        # Make a new RotatingFileHandler for the access log.
        fname = getattr(log, "rot_access_file", "access.log")
        h = handlers.RotatingFileHandler(fname, 'a', maxbytes, backupcount)
        h.setLevel(logging.DEBUG)
        h.setFormatter(_cplogging.logfmt)
        log.access_log.addHandler(h)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号