From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/recipe/
Date: Wed, 24 Jul 2013 09:54:20 +0000 (UTC) [thread overview]
Message-ID: <1374659212.209f3507f6e0add9dd728f544f46a83006b65213.dywi@gentoo> (raw)
commit: 209f3507f6e0add9dd728f544f46a83006b65213
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jul 24 09:46:52 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jul 24 09:46:52 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=209f3507
roverlay/recipe/easylogger: force-set status
force_reset(), freeze_status(): set setup status
setup_initial*(): accept console log level (optional, as keyword)
---
roverlay/recipe/easylogger.py | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
diff --git a/roverlay/recipe/easylogger.py b/roverlay/recipe/easylogger.py
index 5f7ee32..63b0209 100644
--- a/roverlay/recipe/easylogger.py
+++ b/roverlay/recipe/easylogger.py
@@ -22,14 +22,32 @@ ROOT_LOGGER = logging.getLogger()
DEFAULT_DATE_FORMAT = '%F %H:%M:%S'
DEFAULT_STREAM = sys.stdout
+def force_reset ( forced_status=None ):
+ """Enforces the given setup status (or 0). Use with care!
+
+ arguments:
+ * forced_status --
+ """
+ global _STATUS
+ _STATUS = int ( forced_status or 0 )
+# --- end of force_reset (...) ---
+
+def freeze_status():
+ """Enforces a setup status that prevents any subsequent setup*() call.
+ Use with care!
+ """
+ force_reset ( 10 )
+# --- end of freeze_status (...) ---
+
+
def _zap_handlers():
for h in ROOT_LOGGER.handlers:
ROOT_LOGGER.removeHandler ( h )
# --- end of _zap_handlers (...) ---
-def setup_initial_console():
+def setup_initial_console ( log_level=logging.WARN ):
ch = logging.StreamHandler ( stream=DEFAULT_STREAM )
- ch.setLevel ( logging.WARN )
+ ch.setLevel ( log_level )
ch.setFormatter (
logging.Formatter (
@@ -38,7 +56,7 @@ def setup_initial_console():
)
ROOT_LOGGER.addHandler ( ch )
- ROOT_LOGGER.setLevel ( logging.WARN )
+ ROOT_LOGGER.setLevel ( ch.level )
# --- end of setup_initial_console (...) ---
def setup_console ( conf ):
@@ -175,7 +193,7 @@ def setup ( conf ):
_STATUS = 2
-def setup_initial():
+def setup_initial ( log_level=None ):
global _STATUS
if _STATUS > 0:
return
@@ -183,6 +201,9 @@ def setup_initial():
_zap_handlers()
logging.lastResort = None
logging.raiseExceptions = True
- setup_initial_console()
+ if log_level is None:
+ setup_initial_console()
+ else:
+ setup_initial_console ( log_level=log_level )
_STATUS = 1
next reply other threads:[~2013-07-24 9:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-24 9:54 André Erdmann [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-02-22 14:56 [gentoo-commits] proj/R_overlay:master commit in: roverlay/recipe/ André Erdmann
2014-02-15 20:11 André Erdmann
2013-11-14 18:24 André Erdmann
2013-09-06 17:27 André Erdmann
2013-07-11 16:29 André Erdmann
2012-07-06 22:19 André Erdmann
2012-07-05 16:00 André Erdmann
2012-06-27 14:46 André Erdmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1374659212.209f3507f6e0add9dd728f544f46a83006b65213.dywi@gentoo \
--to=dywi@mailerd.de \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox