Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19822
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jsf80238@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.052 |
| X-Spam-Evidence | '*H*': 0.90; '*S*': 0.00; 'modules.': 0.07; 'subject:modules': 0.09; 'argument': 0.15; 'subject:application': 0.15; 'module:': 0.16; 'subject:logging': 0.16; 'url:pastebin': 0.16; "user's": 0.18; 'header:In-Reply-To:1': 0.22; 'sender:addr:gmail.com': 0.25; 'preferred': 0.25; 'module': 0.26; 'variable': 0.27; 'script': 0.28; 'message-id:@mail.gmail.com': 0.28; 'script.': 0.28; 'value.': 0.32; 'modules': 0.32; 'to:addr :python-list': 0.33; 'there': 0.33; 'match': 0.33; 'this.': 0.33; 'received:209.85.160.46': 0.35; 'received:mail- pw0-f46.google.com': 0.35; 'received:209.85.160': 0.35; 'however,': 0.35; 'uses': 0.36; 'to:name:python-list': 0.36; 'received:google.com': 0.37; 'another': 0.37; 'received:209.85': 0.38; 'created': 0.38; 'received:209': 0.39; 'subject:: ': 0.39; 'to:addr:python.org': 0.40; 'according': 0.60; 'more': 0.61; 'specialized': 0.72; 'application:': 0.84; '\xa0one': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=fboLV1ZyM+tsmj4TEj9hxTrNaQFUj7y/fKKiTwEpcQw=; b=f1yQySp+zH6bt7TjZ1HmwoSoFC+g9zsUgptxqHxdmqxJD//UMO4I7AjCQan0NIFIaw T9J3NUTtGZpNG7LPF6boRO3g7G96pk1melmu3zbHfZkDqE8g1QmYAgQhn5xDQ0gmN3fq M1DKbMhbIJWAOFXZYxGgj2TP54mtnrtnA+2KQ= |
| MIME-Version | 1.0 |
| Sender | jsf80238@gmail.com |
| In-Reply-To | <CANy1k1jD_2E2Di2BgzmisnsT6BoFBGNH87M+0MT63UBE-Qsk6Q@mail.gmail.com> |
| References | <CANy1k1jD_2E2Di2BgzmisnsT6BoFBGNH87M+0MT63UBE-Qsk6Q@mail.gmail.com> |
| Date | Fri, 3 Feb 2012 04:50:29 +0000 |
| X-Google-Sender-Auth | -3drcjF9How3cn2w9nz5jcktXKU |
| Subject | Re: Use logging level across application and modules |
| From | Jason Friedman <jason@powerpull.net> |
| To | python-list <python-list@python.org> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5391.1328244633.27778.python-list@python.org> (permalink) |
| Lines | 23 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1328244633 news.xs4all.nl 6943 [2001:888:2000:d::a6]:60360 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:19822 |
Show key headers only | View raw
> Base module: http://pastebin.com/nQCG5CRC > Another module: http://pastebin.com/FFzCCjwG > Application: http://pastebin.com/370cWJtT > > I have a module that will provide base functionality, such as logging > and authentication. > I have other specialized modules that provide additional > functionality. One module will provide database connections, another > information about users and groups, etc. > I have an application script that uses the base module and one or more > specialized modules. > > I want to allow the user to select a preferred logging level. That is > easy to do by passing that level as an argument to base.get_logger(). > However, the application also uses the other module; how do I set the > logging level there to match the user's preference? I figured a way to do this. In the base module I created a global variable loglevel. I set the logging level according to that value. I set the variable from my application script. Because of the memoization of the get_logger() call, the other modules get that same loglevel value.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Use logging level across application and modules Jason Friedman <jason@powerpull.net> - 2012-02-03 04:50 +0000
csiph-web