This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Logger file objects
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: vinay.sajip Nosy List: anthonybaxter, tebeka, vinay.sajip
Priority: normal Keywords: patch

Created on 2004-08-02 08:35 by tebeka, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
__init__.diff tebeka, 2004-08-09 12:47 Diff file
Messages (8)
msg46505 - (view) Author: Miki Tebeka (tebeka) * Date: 2004-08-02 08:35
The logger can return a file like object for each error
These file objects can be sent to any function
expecting a file object.

>> import logging
>> logging.basicConfig()
>> logger = logging.getLogger()
>> err = logger.getFileObject(logging.ERROR)
>> print >> err, "This is an error"
ERROR:root:This is an error

>> err.flush()
>> err.close()
msg46506 - (view) Author: Anthony Baxter (anthonybaxter) (Python triager) Date: 2004-08-09 10:03
Logged In: YES 

msg46507 - (view) Author: Anthony Baxter (anthonybaxter) (Python triager) Date: 2004-08-09 10:03
Logged In: YES 

There's no uploaded file!  You have to check the
checkbox labeled "Check to Upload & Attach File"
when you upload a file. In addition, even if you
*did* check this checkbox, a bug in SourceForge
prevents attaching a file when *creating* an issue.

Please try again.

(This is a SourceForge annoyance that we can do
nothing about. :-( )
msg46508 - (view) Author: Miki Tebeka (tebeka) * Date: 2004-08-09 12:47
Logged In: YES 

Hope it works now...
msg46509 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2004-08-10 15:49
Logged In: YES 

Nice, but I have a question about isatty. Is it needed?
According to the docs for file-like objects, it should not
be implemented unless associated with a real file or device.
msg46510 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2004-08-10 16:12
Logged In: YES 

It's also untidy that the blank line is printed. I can
change it so that if the message text is = "\n", it's not
msg46511 - (view) Author: Miki Tebeka (tebeka) * Date: 2004-08-16 07:02
Logged In: YES 

I guess "isatty" is not needed :-)

I wasn't sure about black lines, what if the user want to
add some black lines to make it easiter to read?

I just see log line as regula lines with a prefix so that
empty lines are only with a prefix.

Your call.
msg46512 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2004-10-12 14:33
Logged In: YES 

Decided not to add to logging module, following feedback
from python-dev.
Date User Action Args
2022-04-11 14:56:06adminsetgithub: 40671
2004-08-02 08:35:34tebekacreate