nanapi/cakephp-fluent-logger-datasource

Fluent Logger DataSource Plugin for CakePHP

1.0.0 2013-12-19 02:02 UTC

README

Fluent Logger Datasource Plugin for CakePHP

Requirements

Installation

Ensure require is present in composer.json. This will install the plugin into Plugin/FluentLoggerDatasource:

{
  "require": {
    "nanapi/cakephp-fluent-logger-datasource": "v1.0.0"
  }
}

app/Config/bootstrap.php

CakePlugin::load('FluentLoggerDatasource');

app/Config/database.php

<?php

class DATABASE_CONFIG {

  public $fluent_logger = array(
    'datasource' => 'FluentLoggerDatasource.FluentLoggerSource',
    'host' => '127.0.0.1',
    // 'port' => '24224',
  );

How to use it

your model

<?php
App::uses('FluentLoggerModel', 'FluentLoggerDatasource.Model');

class MyFluentLogger extends FluentLoggerModel {
}

your controller

<?php
App::uses('AppController', 'Controller');

class MyController extends AppController {
  public $uses = array(
    'MyFluentLogger';
  );

  public function index() {
    $s3 = $this->MyFluentLogger->post('debug.test', array('hello' => 'world'));
  }
}

Methods

This is a wrapper for [Fluent\Logger\FluentLogger][]. For a list of methods that can be used by the Model, please refer to the FluentLogger.