Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added basic docs

  • Loading branch information...
commit dafd47ad7fe9e7fb6a25a6939c365573776389fb 1 parent e665561
@blaflamme blaflamme authored
Showing with 79 additions and 9 deletions.
  1. +76 −9 docs/index.rst
  2. +3 −0  pyramid_amon/__init__.py
View
85 docs/index.rst
@@ -1,17 +1,84 @@
-.. Pyramid Amon documentation master file, created by
- sphinx-quickstart on Tue Oct 30 23:46:26 2012.
- You can adapt this file completely to your liking, but it should at least
- contain the root `toctree` directive.
+Pyramid Amon's documentation
+============================
-Welcome to Pyramid Amon's documentation!
-========================================
+Overview
+--------
-Contents:
+Pyramid Amon is an add-on for the Pyramid Web Framework which allows
+developers to integrate their application with Amon application and system
+monitoring toolkit.
-.. toctree::
- :maxdepth: 2
+Installation
+------------
+Install using setuptools, e.g. (within a virtualenv)::
+ $ easy_install pyramid_amon
+
+Setup
+-----
+
+Once :mod:`pyramid_amon` is installed, you must use the ``config.include``
+mechanism to include it into your Pyramid project's configuration. In your
+Pyramid project's ``__init__.py``:
+
+.. code-block:: python
+
+ config = Configurator(.....)
+ config.include('pyramid_amon')
+
+Alternately, instead of using the Configurator's ``include`` method, you can
+activate Pyramid by changing your application's ``.ini`` file, use the
+following line:
+
+.. code-block:: ini
+
+ pyramid.includes = pyramid_amon
+
+`pyramid_amon` obtains Amon settings from the ``**settings`` dictionary passed
+to the Configurator. It assumes that you've placed Amon configuration
+parameters prefixed with ``amon.config.`` in your Pyramid application's ``.ini`` file.
+For example:
+
+.. code-block:: ini
+
+ [app:myapp]
+ .. other settings ..
+ amon.config.address = http://amon_instance:port
+ amon.config.protocol = http
+ amon.config.secret_key = the-secret-key-from-/etc/amon.conf
+
+Usage
+-----
+
+When this add-on is included into your Pyramid application, whenever a request
+to your application causes an exception to be raised, the add-on will send the
+URL that caused the exception, the exception type, and its related traceback information to an Amon monitoring service you have access.
+
+You also can access logging facilities provided by amonpy.log instance in two
+ways:
+
+.. code-block:: python
+
+ request.amon.log(message, tags)
+
+Or
+
+.. code-block:: python
+
+ from pyramid_amon import get_amon
+ amon = get_amon(request)
+ amon.log({"first_name": "John", "last_name": "Dev", "age": 29}, 'info')
+
+`See Amon documentation for more informations abour configuration and usage
+<http://amon.cx/guide/clients/python/>`_.
+
+API Documentation
+-----------------
+
+.. automodule:: pyramid_amon
+
+.. autofunction:: get_amon
Indices and tables
==================
View
3  pyramid_amon/__init__.py
@@ -102,6 +102,9 @@ class IAmon(Interface):
def get_amon(config_or_request):
+ """Obtain an amonpy instance previously registered via
+ ``config.include('pyramid_amon')``.
+ """
return config_or_request.registry.getUtility(IAmon)
Please sign in to comment.
Something went wrong with that request. Please try again.