summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlec Warner <antarus@gentoo.org>2007-10-23 07:49:22 +0000
committerAlec Warner <antarus@gentoo.org>2007-10-23 07:49:22 +0000
commitc1dadc51bafbef49f4c3189fe6afb83d42fd5f95 (patch)
tree9aefa13c5209351f5485ce1aaa2f62c13f578393
parentab218fdedd7df990b32e02f5c5d16711e475fc77 (diff)
downloadportage-c1dadc51bafbef49f4c3189fe6afb83d42fd5f95.tar.gz
portage-c1dadc51bafbef49f4c3189fe6afb83d42fd5f95.tar.bz2
portage-c1dadc51bafbef49f4c3189fe6afb83d42fd5f95.zip
add quickie logger function
svn path=/main/trunk/; revision=8251
-rw-r--r--pym/portage/util.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/pym/portage/util.py b/pym/portage/util.py
index a7c8a954a..1e3b9cc30 100644
--- a/pym/portage/util.py
+++ b/pym/portage/util.py
@@ -5,6 +5,7 @@
import os
import errno
+import logging
import shlex
import stat
import string
@@ -22,6 +23,15 @@ except ImportError:
noiselimit = 0
+def initialize_logger(level=logging.WARN):
+ """Sets up basic logging of portage activities
+ Args:
+ level: the level to emit messages at ('info', 'debug', 'warning' ...)
+ Returns:
+ None
+ """
+ logging.basicConfig(level=logging.WARN, format='[%(levelname)-4s] %(message)s')
+
def writemsg(mystr,noiselevel=0,fd=None):
"""Prints out warning and debug messages based on the noiselimit setting"""
global noiselimit