Re: Question by someone coming from C...

2008-06-10 Thread John Krukoff
On Wed, 2008-06-11 at 00:43 +0200, Christian Heimes wrote: > John Krukoff wrote: > > Since you probably want access to these from many different places in > > your code, I find the simplest way is to create a logging module of your > > own (not called logging, obviously) and instantiate all of you

Re: Question by someone coming from C...

2008-06-10 Thread Christian Heimes
John Krukoff wrote: > Since you probably want access to these from many different places in > your code, I find the simplest way is to create a logging module of your > own (not called logging, obviously) and instantiate all of your loggers > in that namespace, then import that one module as needed

Re: Question by someone coming from C...

2008-06-10 Thread Bruno Desthuilliers
Skye a écrit : Writing this app in Python, not sure what the "best practice" would be. I want a bitfield global logging level that allows me to turn specific debugging modules on and off. If I was doing this in C, I'd just use some globals like: unsigned int debug_level = 0; #define DEBUG_GENE

Re: Question by someone coming from C...

2008-06-09 Thread Skye
Very cool - I'm liking the pythonic way of doing things more and more. The logger namespace/singleton idea makes great sense! I see how the module variables make globals irrelevant, thanks! Skye -- http://mail.python.org/mailman/listinfo/python-list

Re: Question by someone coming from C...

2008-06-09 Thread Carl Banks
On Jun 9, 5:00 pm, Skye <[EMAIL PROTECTED]> wrote: > Writing this app in Python, not sure what the "best practice" would > be. > > I want a bitfield global logging level that allows me to turn specific > debugging modules on and off. If I was doing this in C, I'd just use > some globals like: > >

Re: Question by someone coming from C...

2008-06-09 Thread Diez B. Roggisch
Skye schrieb: Writing this app in Python, not sure what the "best practice" would be. I want a bitfield global logging level that allows me to turn specific debugging modules on and off. If I was doing this in C, I'd just use some globals like: unsigned int debug_level = 0; #define DEBUG_GENER

Re: Question by someone coming from C...

2008-06-09 Thread John Krukoff
On Mon, 2008-06-09 at 15:02 -0700, Skye wrote: > On Jun 9, 2:35 pm, Matimus <[EMAIL PROTECTED]> wrote: > > The only time to do that sort of thing (in python) is when interacting > > with something else that isn't written in Python though. In general, > > for logging, just use the standard logging

Re: Question by someone coming from C...

2008-06-09 Thread Skye
On Jun 9, 2:35 pm, Matimus <[EMAIL PROTECTED]> wrote: > The only time to do that sort of thing (in python) is when interacting > with something else that isn't written in Python though. In general, > for logging, just use the standard logging > module:http://docs.python.org/lib/module-logging.html

Re: Question by someone coming from C...

2008-06-09 Thread Lie
On Jun 10, 4:32 am, Skye <[EMAIL PROTECTED]> wrote: > OK, sounds good.  So if not bitfields, what would be a good Python-y > way to do it? The word is "pythonic". > Flip booleans in a "debug config" dictionary or something? I'm not really sure, I've been programming with Python (and some other l

Re: Question by someone coming from C...

2008-06-09 Thread Matimus
On Jun 9, 2:00 pm, Skye <[EMAIL PROTECTED]> wrote: > Writing this app in Python, not sure what the "best practice" would > be. > > I want a bitfield global logging level that allows me to turn specific > debugging modules on and off. If I was doing this in C, I'd just use > some globals like: > >

Re: Question by someone coming from C...

2008-06-09 Thread Skye
OK, sounds good. So if not bitfields, what would be a good Python-y way to do it? Flip booleans in a "debug config" dictionary or something? Skye -- http://mail.python.org/mailman/listinfo/python-list

Re: Question by someone coming from C...

2008-06-09 Thread Lie
On Jun 10, 4:00 am, Skye <[EMAIL PROTECTED]> wrote: > Writing this app in Python, not sure what the "best practice" would > be. > > I want a bitfield global logging level that allows me to turn specific > debugging modules on and off.  If I was doing this in C, I'd just use > some globals like: > >

Question by someone coming from C...

2008-06-09 Thread Skye
Writing this app in Python, not sure what the "best practice" would be. I want a bitfield global logging level that allows me to turn specific debugging modules on and off. If I was doing this in C, I'd just use some globals like: unsigned int debug_level = 0; #define DEBUG_GENERAL 0x0001 #defin