diff options
author | Jesse Keating <jkeating@redhat.com> | 2010-01-05 16:43:00 -0800 |
---|---|---|
committer | Jesse Keating <jkeating@redhat.com> | 2010-01-05 16:43:00 -0800 |
commit | c9b2e75fba78c20524d40badf73caafc6b4b36c4 (patch) | |
tree | 724a788fc89d38026a77845c59225f1334f5a3d1 /src | |
parent | d9aaf9fc8b9022b11912861ff7614a82f09dbadb (diff) | |
download | fedora-packager-c9b2e75fba78c20524d40badf73caafc6b4b36c4.tar.gz fedora-packager-c9b2e75fba78c20524d40badf73caafc6b4b36c4.tar.xz fedora-packager-c9b2e75fba78c20524d40badf73caafc6b4b36c4.zip |
Create a logging object that clients can use
Diffstat (limited to 'src')
-rw-r--r-- | src/fedpkg/__init__.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/fedpkg/__init__.py b/src/fedpkg/__init__.py index 17b9867..1baa814 100644 --- a/src/fedpkg/__init__.py +++ b/src/fedpkg/__init__.py @@ -15,6 +15,7 @@ import subprocess import hashlib import koji import rpm +import logging # Define some global variables, put them here to make it easy to change LOOKASIDE = 'http://cvs.fedoraproject.org/repo/pkgs' @@ -25,6 +26,19 @@ GITBASEURL = 'ssh://%(user)s@pkgs.stg.fedoraproject.org/%(module)s' class FedpkgError(Exception): pass +# Setup our logger +# Null logger to avoid spurrious messages, add a handler in app code +class NullHandler(logging.Handler): + def emit(self, record): + pass + +h = NullHandler() +# This is our log object, clients of this library can use this object to +# define their own logging needs +log = logging.getLogger("fedpkg") +# Add the null handler +log.addHandler(h) + # Define some helper functions, they start with _ def _hash_file(file, hashtype): """Return the hash of a file given a hash type""" |