(self, opt, log_loc=None)
Logging function for enabling or disabling
            the logging of messages to a file
Logging function for enabling or disabling
            the logging of messages to a file
Logging function for enabling or disabling the logging of messages to a file
def log(self, opt, log_loc=None):
        """ Logging function for enabling or disabling
            the logging of messages to a file
        """
        if opt and not self.log_data:
            try:
                util.debug('Starting %s logger...')
                self.log_file = open(log_loc, 'w+')

                # chown the log file
                run_usr = util.get_run_usr()
                uid     = getpwnam(run_usr).pw_uid
                gid     = getpwnam(run_usr).pw_gid
                chown(log_loc, uid, gid)
            except Exception, j:
                util.Error('Error opening log file for %s: %s' %
                                (self.which, j))
                self.log_file = None
            self.log_data = True
        elif not opt and self.log_data:
            try:
                self.log_file.close()
                self.log_file = None
                self.log_data = False
                util.debug('%s logger shutdown complete.' % self.which)
            except Exception, j:
                util.Error('Error closing %s: %s' % (self.which, j))
def log ( self , opt , log_loc = None ) : if opt and not self . log_data : try : util . debug ( 'Starting %s logger...' ) self . log_file = open ( log_loc , 'w+' ) # chown the log file run_usr = util . get_run_usr ( ) uid = getpwnam ( run_usr ) . pw_uid gid = getpwnam ( run_usr ) . pw_gid chown ( log_loc , uid , gid ) except Exception , j : util . Error ( 'Error opening log file for %s: %s' % ( self . which , j ) ) self . log_file = None self . log_data = True elif not opt and self . log_data : try : self . log_file . close ( ) self . log_file = None self . log_data = False util . debug ( '%s logger shutdown complete.' % self . which ) except Exception , j : util . Error ( 'Error closing %s: %s' % ( self . which , j ) )