source: TI01-discovery/branches/ingestAutomation-upgrade/OAIBatch/Logger.py @ 3810

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI01-discovery/branches/ingestAutomation-upgrade/OAIBatch/Logger.py@3810
Revision 3810, 727 bytes checked in by cbyrom, 13 years ago (diff)

Create Logger class to standardise output - and allow this to be
switched on/off with a verbose flag.
Implement the logger in several other classes + extend available logging in these.
Also, add a 'usage' method to oai_ingest_new to show proper usage of script.

  • Property svn:executable set to *
Line 
1import commands
2
3class Logger:
4    '''
5    Wrapper class to output logging to help standardise this
6    C Byrom Apr 08
7    '''
8    log_date_string = commands.getoutput("date") + ": "
9    verboseMode = False
10   
11    def __init__(self, verboseMode):
12        '''
13        Constructor - allowing logging to be turned on/off
14        @param verboseMode: if True turn on logging, otherwise don't
15        '''
16        self.verboseMode = verboseMode
17
18    def printOutput(self, message):
19        '''
20        Print message to standard output log - if verbose mode set
21        @param message: output string to send to log
22        '''
23        if (self.verboseMode):
24            print "aa"
25            print self.log_date_string + message
Note: See TracBrowser for help on using the repository browser.