On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames <andreas.0815.qwertz@gmail.com> 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 discussion about whether and how to efficiently admit f-strings to the logging package. I'm guessing that's not gone
anywhere (yet).
Skip
On 7 Oct 2022, at 16:48, Skip Montanaro <skip.montanaro@gmail.com> wrote:
On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames <andreas.0815.qwertz@gmail.com>
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 discussion about whether and how to efficiently admit f-strings to the logging package. I'm guessing that's not gone
anywhere (yet).
Skip
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames <andreas.0815.qwertz@gmail.com> 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 discussion about whether and how to efficiently admit f-strings to the logging package. I'm guessing that's not gone
anywhere (yet).
On 7 Oct 2022, at 18:16, MRAB <python@mrabarnett.plus.com> wrote:
On 2022-10-07 16:45, Skip Montanaro wrote:
Letting you pass in a callable to call might help because that you could use lambda.On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames <andreas.0815.qwertz@gmail.com> >>> wrote:I thought there was some discussion about whether and how to efficiently
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.
admit f-strings to the logging package. I'm guessing that's not gone
anywhere (yet).
--
https://mail.python.org/mailman/listinfo/python-list
On 7 Oct 2022, at 18:16, MRAB <python@mrabarnett.plus.com> wrote:
On 2022-10-07 16:45, Skip Montanaro wrote:
Letting you pass in a callable to call might help because that you could use lambda.On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames <andreas.0815.qwertz@gmail.com>I thought there was some discussion about whether and how to efficiently >> admit f-strings to the logging package. I'm guessing that's not gone
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.
anywhere (yet).
Yep, that’s the obvious way to avoid expensive log data generation.
Would need logging module to support that use case.
On 7 Oct 2022, at 19:09, Weatherby,Gerard <gweatherby@uchc.edu> 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.
From: Python-list <python-list-bounces+gweatherby=uchc.edu@python.org> on behalf of Barry <barry@barrys-emacs.org>python-list__;!!Cn_UX_p3!mrESxAj9YCHsdtNAfkNiY-Zf6U3WTIqaNrgBmbw1ELlQy51ilob43dD0ONsqvg4a94MEdOdwomgyqfyABbvRnA$>
Date: Friday, October 7, 2022 at 1:30 PM
To: MRAB <python@mrabarnett.plus.com>
Cc: python-list@python.org <python-list@python.org>
Subject: Re: Ref-strings in logging messages (was: Performance issue with CPython 3.10 + Cython)
*** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***
On 7 Oct 2022, at 18:16, MRAB <python@mrabarnett.plus.com> wrote:
On 2022-10-07 16:45, Skip Montanaro wrote:
Letting you pass in a callable to call might help because that you could use lambda.On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames <andreas.0815.qwertz@gmail.com>I thought there was some discussion about whether and how to efficiently >>> admit f-strings to the logging package. I'm guessing that's not gone
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.
anywhere (yet).
Yep, that’s the obvious way to avoid expensive log data generation.
Would need logging module to support that use case.
Barry
--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!mrESxAj9YCHsdtNAfkNiY-Zf6U3WTIqaNrgBmbw1ELlQy51ilob43dD0ONsqvg4a94MEdOdwomgyqfyABbvRnA$<https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/
-- https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!mrESxAj9YCHsdtNAfkNiY-Zf6U3WTIqaNrgBmbw1ELlQy51ilob43dD0ONsqvg4a94MEdOdwomgyqfyABbvRnA$<https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!mrESxAj9YCHsdtNAfkNiY-Zf6U3WTIqaNrgBmbw1ELlQy51ilob43dD0ONsqvg4a94MEdOdwomgyqfyABbvRnA$>
--
https://mail.python.org/mailman/listinfo/python-list
On 8 Oct 2022, at 11:50, Weatherby,Gerard <gweatherby@uchc.edu> 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):
return self.fn()
def some_expensive_function():
return "hello"
logging.basicConfig()
logging.debug(Defer(some_expensive_function))
python-list__;!!Cn_UX_p3!mrESxAj9YCHsdtNAfkNiY-Zf6U3WTIqaNrgBmbw1ELlQy51ilob43dD0ONsqvg4a94MEdOdwomgyqfyABbvRnA$>
From: Python-list <python-list-bounces+gweatherby=uchc.edu@python.org <mailto:python-list-bounces+gweatherby=uchc.edu@python.org>> on behalf of Barry <barry@barrys-emacs.org <mailto:barry@barrys-emacs.org>>
Date: Friday, October 7, 2022 at 1:30 PM
To: MRAB <python@mrabarnett.plus.com <mailto:python@mrabarnett.plus.com>>
Cc: python-list@python.org <mailto:python-list@python.org> <python-list@python.org <mailto:python-list@python.org>>
Subject: Re: Ref-strings in logging messages (was: Performance issue with CPython 3.10 + Cython)
*** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***
On 7 Oct 2022, at 18:16, MRAB <python@mrabarnett.plus.com> wrote:
On 2022-10-07 16:45, Skip Montanaro wrote:
Letting you pass in a callable to call might help because that you could use lambda.On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames <andreas.0815.qwertz@gmail.com>I thought there was some discussion about whether and how to efficiently >> admit f-strings to the logging package. I'm guessing that's not gone
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.
anywhere (yet).
Yep, that’s the obvious way to avoid expensive log data generation.
Would need logging module to support that use case.
Barry
-- https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!mrESxAj9YCHsdtNAfkNiY-Zf6U3WTIqaNrgBmbw1ELlQy51ilob43dD0ONsqvg4a94MEdOdwomgyqfyABbvRnA$ <https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/
-- https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!mrESxAj9YCHsdtNAfkNiY-Zf6U3WTIqaNrgBmbw1ELlQy51ilob43dD0ONsqvg4a94MEdOdwomgyqfyABbvRnA$ <https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!mrESxAj9YCHsdtNAfkNiY-Zf6U3WTIqaNrgBmbw1ELlQy51ilob43dD0ONsqvg4a94MEdOdwomgyqfyABbvRnA$>
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 300 |
Nodes: | 16 (3 / 13) |
Uptime: | 72:05:45 |
Calls: | 6,714 |
Calls today: | 2 |
Files: | 12,246 |
Messages: | 5,357,080 |