Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log with invocation context #10

Open
feth opened this issue Mar 24, 2012 · 5 comments
Open

log with invocation context #10

feth opened this issue Mar 24, 2012 · 5 comments
Labels

Comments

@feth
Copy link
Owner

feth commented Mar 24, 2012

At first, we need this poc to work :

from logging import Logger, StreamHandler, Formatter
import sys

logger = Logger("name")

handler = StreamHandler(sys.stdout)

class MyFormatter(Formatter):
    pass


myformatter = MyFormatter()
handler.setFormatter(myformatter)

logger.addHandler(handler)



class Bidon(object):
    """
    >>> b = Bidon()
    [Bidon] coucou
    """
    def __init__(self):
        logger.warning("coucou")
@feth
Copy link
Owner Author

feth commented Mar 24, 2012

@mike-perdide has been working on a spec & is coming with a solution.

@feth
Copy link
Owner Author

feth commented Mar 26, 2012

Let's get dirty!

https://gist.github.com/2203254

@feth
Copy link
Owner Author

feth commented Mar 26, 2012

-gist updated and quite works-
It's a proof of concept that "prints". If we really want this stuff, we now need to validate it a little more and put it in a Formatter.

@feth
Copy link
Owner Author

feth commented Apr 3, 2012

@feth
Copy link
Owner Author

feth commented Apr 3, 2012

Also, LogRecord has a func argument!
Let's explore that!
http://docs.python.org/library/logging.html#logging.LogRecord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant