Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adding logging to metadata class
  • Loading branch information
Joe Erickson committed Nov 16, 2011
1 parent ec56897 commit 90fc5c2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions S3/MetaData.py
Expand Up @@ -5,6 +5,7 @@

import cPickle
import os
from logging import debug, info, warning, error

class MetaData(object):
_instance = None
Expand All @@ -24,6 +25,8 @@ def __init__(self):
elif os.name == "nt" and os.getenv("USERPROFILE"):
metadata_file = os.path.join(os.getenv("USERPROFILE").decode('mbcs'), "Application Data", "s3metadata.ini")

debug(u"Loading metadata from %s" % metadata_file)

if os.path.exists(metadata_file):
self.metadata = cPickle.load(open(metadata_file, 'rb'))

Expand All @@ -35,6 +38,7 @@ def save(self):
elif os.name == "nt" and os.getenv("USERPROFILE"):
metadata_file = os.path.join(os.getenv("USERPROFILE").decode('mbcs'), "Application Data", "s3metadata.ini")

debug(u"Saving metadata to %s" % metadata_file)
try:
cPickle.dump(self.metadata, open(metadata_file, 'wb'), -1)
except IOError, e:
Expand Down

0 comments on commit 90fc5c2

Please sign in to comment.