/[gli]/branches/overhaul/src/GLILogger.py
Gentoo

Contents of /branches/overhaul/src/GLILogger.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1532 - (show annotations) (download) (as text)
Sun Oct 22 00:08:21 2006 UTC (12 years ago) by codeman
File MIME type: text/x-python
File size: 1336 byte(s)
adding a new branch for the overhaul of GLI

1 """
2 # Copyright 1999-2005 Gentoo Foundation
3 # This source code is distributed under the terms of version 2 of the GNU
4 # General Public License as published by the Free Software Foundation, a copy
5 # of which can be found in the main directory of this project.
6 Gentoo Linux Installer
7
8 $Id: GLILogger.py,v 1.9 2005/08/22 18:35:51 codeman Exp $
9
10 Logger is a singleton style generic logger object.
11 """
12
13 import time
14
15 class Logger(object):
16
17 _LOG_FILE_PATH = "install.log"
18 _SHARED_LOGGER = None
19
20 ##
21 # Creates a shared logger like in GLIClientConfiguration
22 # @param cls It's just done like that.
23 def shared_logger(cls):
24 if Logger._SHARED_LOGGER == None:
25 Logger._SHARED_LOGGER = Logger()
26
27 return Logger._SHARED_LOGGER
28
29 ##
30 # Basic Initialization function. Appends to the given logfile
31 # @param logfile=None file to log stuff to.
32 def __init__(self,logfile=None):
33 if logfile == None:
34 self._file = file(Logger._LOG_FILE_PATH, 'a')
35 else:
36 self._file = file(logfile,'a')
37
38 ##
39 # Logs the given message to the logfile
40 # @param message Parameter description
41 def log(self, message):
42 self._file.write("GLI: " + time.strftime("%B %d %Y %H:%M:%S") + " - " + message + "\n")
43 self._file.flush()
44
45 ##
46 # Inserts a mark into the logfile.
47 def mark(self):
48 self.log(" -- MARK -- ")
49
50 shared_logger = classmethod(shared_logger)

Properties

Name Value
svn:eol-style native

  ViewVC Help
Powered by ViewVC 1.1.20