Logo Search packages:      
Sourcecode: lastfmsubmitd version File versions  Download package

def lastfm::client::Client::open_log (   self,
  debug = False,
  stderr = False 
) [inherited]

Returns a logging object that will write to the client's log. If
``debug`` is true, the client's debug setting will be overridden and
the logging object's level will be set to DEBUG. If ``stderr`` is
true, the object will also print all messages to stderr.

Definition at line 29 of file client.py.

00029                                                  :
        """Returns a logging object that will write to the client's log. If
        ``debug`` is true, the client's debug setting will be overridden and
        the logging object's level will be set to DEBUG. If ``stderr`` is
        true, the object will also print all messages to stderr."""

        if debug or self.conf.debug:
            level = logging.DEBUG
        else:
            level = logging.INFO

        self.log = logging.getLogger(self.name)
        self.log.setLevel(level)

        try:
            filefmt = \
                '%(asctime)s %(name)s[%(process)s] %(levelname)s: %(message)s'
            oldmask = os.umask(002)
            filehandler = logging.FileHandler(self.conf.log_path)
            filehandler.setLevel(level)
            filehandler.setFormatter(logging.Formatter(filefmt))
            self.log.addHandler(filehandler)
            os.umask(oldmask)
        except IOError:
            # If we can't log it here, better do it somewhere...
            stderr = True

        if stderr:
            stderrfmt = '%(asctime)s %(levelname)s: %(message)s'
            stderrhandler = logging.StreamHandler(sys.stderr)
            stderrhandler.setLevel(level)
            stderrhandler.setFormatter(logging.Formatter(stderrfmt))
            self.log.addHandler(stderrhandler)

    def submit_many(self, songs):


Generated by  Doxygen 1.6.0   Back to index