Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #45671
| X-Received | by 10.224.174.145 with SMTP id t17mr1728283qaz.4.1369150006402; Tue, 21 May 2013 08:26:46 -0700 (PDT) |
|---|---|
| X-Received | by 10.49.30.105 with SMTP id r9mr214513qeh.27.1369150006383; Tue, 21 May 2013 08:26:46 -0700 (PDT) |
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!l3no10776319qak.0!news-out.google.com!y6ni50756qax.0!nntp.google.com!ch1no167311qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.python |
| Date | Tue, 21 May 2013 08:26:46 -0700 (PDT) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=109.193.150.124; posting-account=uWp_DQoAAAAB_4sy58IrJ5P35MLHIIOK |
| NNTP-Posting-Host | 109.193.150.124 |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <02f0123d-2f9e-4287-b983-cfa1db9db69c@googlegroups.com> (permalink) |
| Subject | @staticmethods called more than once |
| From | Christian <mining.facts@gmail.com> |
| Injection-Date | Tue, 21 May 2013 15:26:46 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Xref | csiph.com comp.lang.python:45671 |
Show key headers only | View raw
Hi,
i'm somewhat confused working with @staticmethods. My logger and configuration methods are called n times, but I have only one call.
n is number of classes which import the loger and configuration class
in the subfolder mymodule. What might be my mistake mistake?
Many thanks
Christian
### __init__.py ###
from mymodule.MyLogger import MyLogger
from mymodule.MyConfig import MyConfig
##### my_test.py ##########
from mymodule import MyConfig,MyLogger
#Both methods are static
key,logfile,loglevel = MyConfig().get_config('Logging')
log = MyLogger.set_logger(key,logfile,loglevel)
log.critical(time.time())
#Output
2013-05-21 17:20:37,192 - my_test - 17 - CRITICAL - 1369149637.19
2013-05-21 17:20:37,192 - my_test - 17 - CRITICAL - 1369149637.19
2013-05-21 17:20:37,192 - my_test - 17 - CRITICAL - 1369149637.19
2013-05-21 17:20:37,192 - my_test - 17 - CRITICAL - 1369149637.19
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
@staticmethods called more than once Christian <mining.facts@gmail.com> - 2013-05-21 08:26 -0700
Re: @staticmethods called more than once Skip Montanaro <skip@pobox.com> - 2013-05-21 10:39 -0500
Re: @staticmethods called more than once John Gordon <gordon@panix.com> - 2013-05-21 16:34 +0000
Re: @staticmethods called more than once John Gordon <gordon@panix.com> - 2013-05-21 16:48 +0000
Re: @staticmethods called more than once Christian <mining.facts@gmail.com> - 2013-05-21 10:17 -0700
Re: @staticmethods called more than once Ethan Furman <ethan@stoneleaf.us> - 2013-05-21 09:30 -0700
Re: @staticmethods called more than once 88888 Dihedral <dihedral88888@googlemail.com> - 2013-05-21 18:23 -0700
csiph-web