forked from M-Labs/artiq
1
0
Fork 0

Merge branch 'master' into epoch_time

This commit is contained in:
Robert Jördens 2017-08-03 12:55:01 +02:00 committed by GitHub
commit dd6c48fed2
2 changed files with 8 additions and 9 deletions

View File

@ -51,8 +51,9 @@ Release notes
* The PDQ(2/3) driver has been removed and is now being maintained out-of tree * The PDQ(2/3) driver has been removed and is now being maintained out-of tree
at https://github.com/m-labs/pdq. All SPI/USB driver layers, Mediator, at https://github.com/m-labs/pdq. All SPI/USB driver layers, Mediator,
CompoundPDQ and examples/documentation has been moved. CompoundPDQ and examples/documentation has been moved.
* The results keys start_time and run_time are now stored as doubles, rather * The master now rotates log files at midnight, rather than based on log size.
than ints. * The results keys start_time and run_time are now stored as doubles of UNIX time,
rather than ints of local time.
2.4 2.4

View File

@ -27,11 +27,9 @@ def log_args(parser):
group.add_argument("--log-file", default="", group.add_argument("--log-file", default="",
help="store logs in rotated files; set the " help="store logs in rotated files; set the "
"base filename") "base filename")
group.add_argument("--log-max-size", type=int, default=1024, group.add_argument("--log-backup-count", type=int, default=0,
help="maximum size of each log file in KiB " help="number of old log files to keep, or 0 to keep "
"(default: %(default)d)") "all log files. '.<yyyy>-<mm>-<dd>' is added "
group.add_argument("--log-backup-count", type=int, default=6,
help="number of old log files to keep (.<n> is added "
"to the base filename (default: %(default)d)") "to the base filename (default: %(default)d)")
@ -47,9 +45,9 @@ def init_log(args):
handlers.append(console_handler) handlers.append(console_handler)
if args.log_file: if args.log_file:
file_handler = logging.handlers.RotatingFileHandler( file_handler = logging.handlers.TimedRotatingFileHandler(
args.log_file, args.log_file,
maxBytes=args.log_max_size*1024, when="midnight",
backupCount=args.log_backup_count) backupCount=args.log_backup_count)
file_handler.setFormatter(logging.Formatter( file_handler.setFormatter(logging.Formatter(
"%(asctime)s %(levelname)s:%(source)s:%(name)s:%(message)s")) "%(asctime)s %(levelname)s:%(source)s:%(name)s:%(message)s"))