from daklib.daklog import Logger
from daklib.config import Config
+from daklib.dak_exceptions import CantOpenError
################################################################################
def main():
"""Launch dak functionality."""
- logger = Logger(Config(), 'dak top-level', print_starting=False)
+
+ try:
+ logger = Logger(Config(), 'dak top-level', print_starting=False)
+ except CantOpenError:
+ logger = None
functionality = init()
modules = [ command for (command, _) in functionality ]
except KeyboardInterrupt:
msg = 'KeyboardInterrupt caught; exiting'
print msg
- logger.log([msg])
+ if logger:
+ logger.log([msg])
sys.exit(1)
except SystemExit:
pass
except:
- for line in traceback.format_exc().split('\n')[:-1]:
- logger.log(['exception', line])
+ if logger:
+ for line in traceback.format_exc().split('\n')[:-1]:
+ logger.log(['exception', line])
raise
################################################################################