Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

PHP Client for Amon

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 amon
Octocat-spinner-32 example
Octocat-spinner-32 README.md
Octocat-spinner-32 amon.php
Octocat-spinner-32 benchmark.php
README.md

Install

Download the client from https://github.com/martinrusev/amon-php

Configuration

require_once 'amon.php'
Amon::config(array('host'=> 'http://127.0.0.1', 'port' => 2464, 
'secret_key': 'the secret key from /etc/amonlite.conf'));

Usage

Logging

You can use the logging module in any PHP application:

# message - array, string
Amon::log(message, tags);

# Will still work and in the web interface you will see these logs with level 'unset'
Amon::log(message);

# Tagged logging
Amon::log(message, array('debug', 'info'));

Exception handling

To capture exceptions triggered from your PHP applications, add the following 2 lines in your index.php file

require "amon.php";
Amon::setup_exception_handler();
Something went wrong with that request. Please try again.