mozilla-services / metlog-py

INACTIVE - http://mzl.la/ghe-archive - Python library for Services metrics logging
36 stars 8 forks source link

Where are the examples? #9

Closed jbalogh closed 12 years ago

jbalogh commented 12 years ago

The closest thing to examples that I could find is on the config page: http://readthedocs.org/docs/metlog-py/en/latest/config.html, which has a chunk of code.

I don't know what to import or how to use it.

rafrombrc commented 12 years ago

Thanks for the bug. I'll work on getting some examples into the docs this week. In the meantime, the main API is exposed by the client object:

http://readthedocs.org/docs/metlog-py/en/latest/api/client.html#module-metlog.client

And, ugh, looking at that page, I realize that our logger-style convenience methods aren't showing up, presumably b/c they don't have docstrings. Hate to ask this of you, but you probably also want to look at the client source:

https://github.com/mozilla-services/metlog-py/blob/master/metlog/client.py#L131

You can get a client instance via the "clientfrom*" functions in the config module. We're working on some support code to let folks use a sort of b/w compatible "getLogger" type call at module scope to access configured clients, but the recommendation is actually that you get the client in your app initialization code and store it somewhere you can access it. In our pyramid apps, for instance, we're storing the client on the pyramid registry object, where it can be accessed via "request.registry['metlog']".

rafrombrc commented 12 years ago

It's still a bit meager, but now there are at least some basic "getting started" prose docs w/ a couple of examples:

http://readthedocs.org/docs/metlog-py/en/latest/getstarted.html

jbalogh commented 12 years ago

Thanks!