> On 8 Oct 2022, at 11:50, Weatherby,Gerard wrote:
>
> Logging does support passing a callable, if indirectly. It only calls __str__
> on the object passed if debugging is enabled.
>
> class Defer:
>
> def __init__(self,fn):
> self.fn = fn
>
> def __str__(self):
>
Logging does support passing a callable, if indirectly. It only calls __str__
on the object passed if debugging is enabled.
class Defer:
def __init__(self,fn):
self.fn = fn
def __str__(self):
return self.fn()
def some_expensive_function():
return "hello"
On Fri, 7 Oct 2022 18:28:06 +0100
Barry wrote:
> > On 7 Oct 2022, at 18:16, MRAB wrote:
> >
> > On 2022-10-07 16:45, Skip Montanaro wrote:
> >>> On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames
> >>>
> >>> wrote:
> >>> 1. The culprit was me. As lazy as I am, I have used f-strings all over the
> On 7 Oct 2022, at 19:09, Weatherby,Gerard wrote:
> The obvious way to avoid log generation is:
>
> if logger.isEnableFor(logging.DEBUG):
>logger.debug( expensive processing )
>
>
> Of course, having logging alter program flow could lead to hard to debug bugs.
Altered flow
The obvious way to avoid log generation is:
if logger.isEnableFor(logging.DEBUG):
logger.debug( expensive processing )
Of course, having logging alter program flow could lead to hard to debug bugs.
From: Python-list on
behalf of Barry
Date: Friday, October 7, 2022 at 1:30 PM
> On 7 Oct 2022, at 18:16, MRAB wrote:
>
> On 2022-10-07 16:45, Skip Montanaro wrote:
>>> On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames
>>> wrote:
>>> 1. The culprit was me. As lazy as I am, I have used f-strings all over the
>>> place in calls to `logging.logger.debug()` and friends,
On 2022-10-07 16:45, Skip Montanaro wrote:
On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames
wrote:
1. The culprit was me. As lazy as I am, I have used f-strings all over the
place in calls to `logging.logger.debug()` and friends, evaluating all
arguments regardless of whether the logger was
> On 7 Oct 2022, at 16:48, Skip Montanaro wrote:
>
> On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames
> wrote:
>
>> 1. The culprit was me. As lazy as I am, I have used f-strings all over the
>> place in calls to `logging.logger.debug()` and friends, evaluating all
>> arguments regardless of
Dang autocorrect. Subject first word was supposed to be "f-strings" not
"ref-strings." Sorry about that.
S
On Fri, Oct 7, 2022, 10:45 AM Skip Montanaro
wrote:
>
>
> On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames
> wrote:
>
>> 1. The culprit was me. As lazy as I am, I have used f-strings all over
On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames
wrote:
> 1. The culprit was me. As lazy as I am, I have used f-strings all over the
> place in calls to `logging.logger.debug()` and friends, evaluating all
> arguments regardless of whether the logger was enabled or not.
>
I thought there was some
10 matches
Mail list logo