Skip to content
This repository
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 18 lines (14 sloc) 0.528 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/usr/bin/env python

import logging
import os

class GroupWriteRotatingFileHandler(logging.handlers.RotatingFileHandler):
    """
Rotating logger which also adds group+writable permissions.

Tip from:
http://stackoverflow.com/questions/1407474/does-python-logging-handlers-rotatingfilehandler-allow-creation-of-a-group-writab/6779307#6779307
"""
    def _open(self):
        old_umask = os.umask(0o002)
        f = logging.handlers.RotatingFileHandler._open(self)
        os.umask(old_umask)

        return f
Something went wrong with that request. Please try again.