summaryrefslogtreecommitdiff
path: root/updatewcs/__init__.py
diff options
context:
space:
mode:
authordencheva <dencheva@stsci.edu>2011-06-02 10:08:53 -0400
committerdencheva <dencheva@stsci.edu>2011-06-02 10:08:53 -0400
commit5083538477943bc59bb6c779a8d2170868205c0a (patch)
tree5e593a744495452c7f3306cf140fd991e8bd8742 /updatewcs/__init__.py
parent1bea0d0bb9a21ec64d62216ae8bb084d7bb158ff (diff)
downloadstwcs_hcf-5083538477943bc59bb6c779a8d2170868205c0a.tar.gz
Initially the log file was defined at the top level. Moved it to updatewcs to avoid creating an empty file when logging is not requested.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@12996 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'updatewcs/__init__.py')
-rw-r--r--updatewcs/__init__.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/updatewcs/__init__.py b/updatewcs/__init__.py
index c98e67f..ab852d0 100644
--- a/updatewcs/__init__.py
+++ b/updatewcs/__init__.py
@@ -77,6 +77,12 @@ def updatewcs(input, vacorr=True, tddcorr=True, npolcorr=True, d2imcorr=True,
if verbose == False:
logger.setLevel(100)
else:
+ formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
+ log_filename = 'stwcs.log'
+ fh = logging.FileHandler(log_filename, mode='w')
+ fh.setLevel(logging.DEBUG)
+ fh.setFormatter(formatter)
+ logger.addHandler(fh)
logger.setLevel(verbose)
args = "vacorr=%s, tddcorr=%s, npolcorr=%s, d2imcorr=%s, checkfiles=%s, \
wcskey=%s, wcsname=%s, clobber=%s" % (str(vacorr), str(tddcorr), str(npolcorr),