priorities[entry] = name
if not Options["No-Action"]:
- Logger = daklog.Logger(cnf, "check-overrides")
+ Logger = daklog.Logger("check-overrides")
else:
- Logger = daklog.Logger(cnf, "check-overrides", 1)
+ Logger = daklog.Logger("check-overrides", 1)
for osuite in cnf.SubTree("Check-Overrides::OverrideSuites").List():
if "1" != cnf["Check-Overrides::OverrideSuites::%s::Process" % osuite]:
if Options["Help"]:
usage()
- Logger = daklog.Logger(cnf, 'clean-queues', Options['No-Action'])
+ Logger = daklog.Logger('clean-queues', Options['No-Action'])
init(cnf)
if Options["Help"]:
usage()
- Logger = daklog.Logger(cnf, "clean-suites", debug=Options["No-Action"])
+ Logger = daklog.Logger("clean-suites", debug=Options["No-Action"])
session = DBConn().session()
################################################################################
def write_all(cnf, suite_names = [], component_names = [], force = None):
- Logger = daklog.Logger(cnf.Cnf, 'contents generate')
+ Logger = daklog.Logger('contents generate')
ContentsWriter.write_all(Logger, suite_names, component_names, force)
Logger.close()
################################################################################
def binary_scan_all(cnf, limit):
- Logger = daklog.Logger(cnf.Cnf, 'contents scan-binary')
+ Logger = daklog.Logger('contents scan-binary')
result = BinaryContentsScanner.scan_all(limit)
processed = '%(processed)d packages processed' % result
remaining = '%(remaining)d packages remaining' % result
################################################################################
def source_scan_all(cnf, limit):
- Logger = daklog.Logger(cnf.Cnf, 'contents scan-source')
+ Logger = daklog.Logger('contents scan-source')
result = SourceContentsScanner.scan_all(limit)
processed = '%(processed)d packages processed' % result
remaining = '%(remaining)d packages remaining' % result
utils.warn("In No-Action Mode")
action = False
- Logger = daklog.Logger(cnf.Cnf, "control-overrides", mode)
+ Logger = daklog.Logger("control-overrides", mode)
if file_list:
for f in file_list:
process_file(utils.open_file(f), suite, component, otype, mode, action, session)
if action == "list":
get_list(suite, session)
else:
- Logger = daklog.Logger(cnf.Cnf, "control-suite")
+ Logger = daklog.Logger("control-suite")
if file_list:
for f in file_list:
process_file(utils.open_file(f), suite, action, session, britney, force)
try:
- logger = Logger(Config(), 'dak top-level', print_starting=False)
+ logger = Logger('dak top-level', print_starting=False)
except CantOpenError:
logger = None
Options = cnf.SubTree("Obsolete::Options")
if Options['Help']:
usage()
- Logger = daklog.Logger(cnf.Cnf, "dominate")
+ Logger = daklog.Logger("dominate")
session = DBConn().session()
for suite_name in utils.split_args(Options['Suite']):
suite = session.query(Suite).filter_by(suite_name = suite_name).one()
if Options.has_key("Force") and Options["Force"]:
force = True
- logger = daklog.Logger(cnf, 'external-overrides')
+ logger = daklog.Logger('external-overrides')
command = args[0]
if command in ('import', 'i'):
def main():
cnf = Config()
- Logger = daklog.Logger(cnf, 'generate-filelist')
+ Logger = daklog.Logger('generate-filelist')
Arguments = [('h', "help", "Filelist::Options::Help"),
('s', "suite", "Filelist::Options::Suite", "HasArg"),
('c', "component", "Filelist::Options::Component", "HasArg"),
if Options["Help"]:
usage()
- Logger = daklog.Logger(cnf, 'generate-packages-sources')
+ Logger = daklog.Logger('generate-packages-sources')
session = DBConn().session()
if Options.has_key("Help"):
usage()
- logger = daklog.Logger(cnf, 'generate-packages-sources2')
+ logger = daklog.Logger('generate-packages-sources2')
session = DBConn().session()
if Options["Help"]:
usage()
- Logger = daklog.Logger(cnf, 'generate-releases')
+ Logger = daklog.Logger('generate-releases')
session = DBConn().session()
if Options["Help"]:
usage()
- Logger = daklog.Logger(cnf.Cnf, 'make-maintainers')
+ Logger = daklog.Logger('make-maintainers')
session = DBConn().session()
# dictionary packages to maintainer names
if Options["Help"]:
usage()
- Logger = daklog.Logger(cnf, 'manage-build-queues', Options['No-Action'])
+ Logger = daklog.Logger('manage-build-queues', Options['No-Action'])
starttime = datetime.now()
################################################################################
def scan_all(cnf, mode, limit):
- Logger = daklog.Logger(cnf.Cnf, 'metadata scan (%s)' % mode)
+ Logger = daklog.Logger('metadata scan (%s)' % mode)
result = MetadataScanner.scan_all(mode, limit)
processed = '%(processed)d %(type)s processed' % result
remaining = '%(remaining)d %(type)s remaining' % result
Options["Sudo"] = ""
if not Options["Sudo"] and not Options["No-Action"]:
- Logger = daklog.Logger(cnf.Cnf, "security-install")
+ Logger = daklog.Logger("security-install")
session = DBConn().session()
game_over()
- Logger = daklog.Logger(cnf.Cnf, "override")
+ Logger = daklog.Logger("override")
dsc_otype_id = get_override_type('dsc').overridetype_id
if not Options["No-Action"]:
try:
- Logger = daklog.Logger(cnf, "process-new")
+ Logger = daklog.Logger("process-new")
except CantOpenError, e:
Options["Trainee"] = "True"
if not Options["No-Action"]:
try:
- Logger = daklog.Logger(cnf, "process-policy")
+ Logger = daklog.Logger("process-policy")
except CantOpenError, e:
Logger = None
log_urgency = True
UrgencyLog()
- Logger = daklog.Logger(cnf, "process-upload", Options["No-Action"])
+ Logger = daklog.Logger("process-upload", Options["No-Action"])
# If we have a directory flag, use it to find our files
if cnf["Dinstall::Options::Directory"] != "":
# Ok, try and find the configuration table
print "Determining dak database revision ..."
cnf = Config()
- logger = Logger(cnf.Cnf, 'update-db')
+ logger = Logger('update-db')
try:
# Build a connect string
"Logger object"
__shared_state = {}
- def __init__(self, *args, **kwargs):
+ def __init__(self, program='unknown', debug=False, print_starting=True, include_pid=False):
self.__dict__ = self.__shared_state
- if not getattr(self, 'initialised', False):
- from daklib.config import Config
- self.initialised = True
-
- # To be backwards compatibile, dump the first argument if it's a
- # Config object. TODO: Fix up all callers and remove this
- if len(args) > 0 and isinstance(args[0], Config):
- args = list(args)
- args.pop(0)
-
- self.__setup(*args, **kwargs)
-
-
- def __setup(self, program='unknown', debug=False, print_starting=True, include_pid=False):
- "Initialize a new Logger object"
self.program = program
self.debug = debug
self.include_pid = include_pid
+ if not getattr(self, 'logfile', None):
+ self._open_log(debug)
+
+ if print_starting:
+ self.log(["program start"])
+
+ def _open_log(self, debug):
# Create the log directory if it doesn't exist
from daklib.config import Config
logdir = Config()["Dir::Log"]
self.logfile = logfile
- if print_starting:
- self.log(["program start"])
-
def log (self, details):
"Log an event"
# Prepend timestamp, program name, and user name