On 12 Sep, 19:17, [EMAIL PROTECTED] wrote:
> It seems like using something other than a literal string in the
> message is the way to go, since I assume that its __repr__() won't get
> called unless the logger is actually going to log a message for it.
> Is that right?
>
> Are any of the other meth
On Sep 12, 10:46 am, Vinay Sajip <[EMAIL PROTECTED]> wrote:
> On 11 Sep, 17:14, [EMAIL PROTECTED] wrote:
>
> > What is the best way to do this, so that I don't have to manually put
> > the self.ctx in the log string in hundreds of different places?
>
> Another way is to generate your log messages v
On 11 Sep, 17:14, [EMAIL PROTECTED] wrote:
> What is the best way to do this, so that I don't have to manually put
> the self.ctx in the log string in hundreds of different places?
>
Another way is to generate your log messages via a factory method
which prepends the context: you can do this via a
On 9/11/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I think the following question is clearer.
>
> I want to make it so that method1 below can be transformed:
>
> logger = logging.getLogger("somelogger")
> class SomeOp:
> def __init__(self, ctx):
> self.ctx = ctx
> def method
I think the following question is clearer.
I want to make it so that method1 below can be transformed:
logger = logging.getLogger("somelogger")
class SomeOp:
def __init__(self, ctx):
self.ctx = ctx
def method1(self):
logger.info("%s: here's a message", self.ctx)
lo
Suppose I have some sort of context variable that I want to appear in
log messages. E.g.:
logger = logging.getLogger("somelogger")
class SomeOp:
def __init__(self, ctx):
self.ctx = ctx
def method1(self):
logger.info("%s: here's a message", self.ctx)
What's the idiomatic w