jejd14/clog

A small class for logging information about classes and methods

dev-master 2015-05-10 17:20 UTC

This package is not auto-updated.

Last update: 2025-06-25 12:14:21 UTC


README

Scrutinizer Code Quality Code Coverage Build Status License

CLog

About

A small class for logging information about classes and methods

##PHP Version

PHP >= 5.4.0
Tested on Anax-MVC >= 2.0.4

Introduction

Instantiate an object of CLog:

$newClog = new \jejd14\clog\Clog();

Or instantiate an object of CLog as a shared service within the Anax framework:

$di->setShared('log', function() {
    $log = new \jejd14\clog\CLog();
    return $log;
});

Methods

  1. timestamp ( $domain, $where, $comment = null) - Log a event with a time.
  2. timestampAsTable () - Print all timestamps to a table.
  3. pageLoadTime() - Print page per load time.
  4. memoryPeak() - Print memory peak.

Calling of Methods

To properly use the method timestamp listed above you can call it as follows (Assuming you've set the service as a shared service in your frontcontroller)

Inside a class that extends/implements/uses \Anax\DI\TInjectionAware:

$this->di->log->timestamp(__CLASS__, __METHOD__, "A breif comment");

In your frontcontroller:

$app->log->timestamp(__CLASS__, __METHOD__, "A breif comment");

CLASS and METHOD are magic constants in PHP.

To get all the timestamps as a table:

$table = $app->log->timestampAsTable();

Composer

You can add clog to your composer.json file like this.

"require": {
  "jejd14/clog": "dev-master"
 }

License

MIT