timestamps and appending for import log (#155)

This commit is contained in:
Adrian Sampson 2011-05-03 12:34:31 -07:00
parent 2dbfbc8923
commit 1a86efc39f
2 changed files with 8 additions and 1 deletions

4
NEWS
View file

@ -2,6 +2,10 @@
-----
* Prompts in the importer interface are now colorized for easy
reading. The default option is always highlighted.
* The import logger has been improved for "always-on" use. First,
it is now possible to specify a log file in .beetsconfig. Also,
logs are now appended rather than overwritten and contain
timestamps.
* Fix crash when autotagging files with no metadata.
1.0b8

View file

@ -19,6 +19,7 @@ from __future__ import with_statement # Python 2.5
import logging
import sys
import os
import time
from beets import ui
from beets.ui import print_
@ -426,7 +427,8 @@ def import_files(lib, paths, copy, write, autot, logpath, art, threaded,
# Open the log.
if logpath:
logpath = normpath(logpath)
logfile = open(syspath(logpath), 'w')
logfile = open(syspath(logpath), 'a')
print >>logfile, 'import started', time.asctime()
else:
logfile = None
@ -458,6 +460,7 @@ def import_files(lib, paths, copy, write, autot, logpath, art, threaded,
# If we were logging, close the file.
if logfile:
print >>logfile, ''
logfile.close()
# Emit event.