[issue43058] setting a logging Handler name

2021-01-28 Thread Brett Cohen


New submission from Brett Cohen :

When using the logging module to add a new handler, the documentation doesn't 
mention the ability to set the name of the handler. It turns out that it's 
actually a supported feature by using:

handler_instance.set_name("YOUR_NAME_HERE")

I'd suggest updating the documentation to indicate the ability to set the name 
of the handler. It'd be very nice if the name was settable in the constructor 
of the Handler class. This could be done by including an optional `name` 
argument that defaults to None:

class Handler(Filterer):
def __init__(self, level=NOTSET, name=None):
Filterer.__init__(self)
self._name = name
...
...

I noticed the problem when trying to call logging.config.dictConfig with a 
config which specified a handler (it crashes: `ValueError: No handler found 
with name 'my_handler'`).

I initially thought to manually alter the _handlers directly since the docs 
didn't indicate how to set the name. After digging into the source code I found 
the undocumented `set_name` function.

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 385880
nosy: bcohen, docs@python, vinay.sajip
priority: normal
severity: normal
status: open
title: setting a logging Handler name
type: enhancement
versions: Python 3.8

___
Python tracker 
<https://bugs.python.org/issue43058>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



RE: Python-list Digest, Vol 29, Issue 147

2006-02-10 Thread Brett Cohen
nope, we where one short plus mark just pulled out so now we're two short. if 
you can get ANYONE that would be great?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf
Of [EMAIL PROTECTED]
Sent: 10 February 2006 02:21
To: python-list@python.org
Subject: Python-list Digest, Vol 29, Issue 147


Send Python-list mailing list submissions to
python-list@python.org

To subscribe or unsubscribe via the World Wide Web, visit
http://mail.python.org/mailman/listinfo/python-list
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]

You can reach the person managing the list at
[EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than Re: Contents of Python-list digest...
IMPORTANT NOTICE:

If you are not the intended recipient of this email (or such person's 
authorised representative), then :

(a) please notify the sender of this email immediately by return email, 
facsimile or telephone and delete this message from your system;
(b) you may not print, store, forward or copy this message or any part thereof 
or disclose or cause information in this message to be 
disclosed to any other person.

The information in or attached to this email message is confidential and may be 
subject to legal privilege and client confidentiality. 
In addition this message is subject to important restrictions, qualifications 
and disclaimers (the disclaimer) that must be accessed and 
read by copying the following address into your Internet browser's address bar 
: http://www.investec.com/emaildisclaimer/

The disclaimer also provides our corporate information and names of our 
directors as required by law.

The disclaimer is deemed to form part of this message in terms of Section 11 of 
the Electronic Communications and Transactions Act 25 of 2002. 
If you cannot access the disclaimer, please obtain a copy thereof from us by 
sending an email to : [EMAIL PROTECTED]

Certain entities within the Investec group of companies are registered as 
authorised financial services providers.
The details of these entities are available on our website : 
http://www.investec.com/southafrica 
-- 
http://mail.python.org/mailman/listinfo/python-list