Skip to content

A CLI Tool to make looking up cakephp's log more easily.

Notifications You must be signed in to change notification settings

CYDASCOM/cakelog

Repository files navigation

About

Node.js CI

A CLI Tool to make looking up cakephp's log more easily.

Install

sudo npm i -g cakelog

Usage

Usage: cakelog [options]

Options:
  -d, --debug     Just output Debug logs
  -i, --info      Just output Info logs
  -nos, --nosql   Ignore Sql output
  -s, --sql       Ignore Sql output except the Sql before "After Query"
  -h, --help      Display help for command
no option
cakelog

Like Linux command tail -f, output the latest logs.

--debug
cakelog --debug

Just output Debug logs where is using:

CakeLog::debug();
--info
cakelog --info

Just output Info logs where is using:

CakeLog::info();
--nosql
cakelog --nosql

There are so many sql logs, using --nosql to ignore all sql log output, when we want to focus on debug or info logs.

--sql
cakelog --sql

Sometimes, we want to see the sql created by cakephp, for this scenario, add CakeLog::info("After Query"); after query statement immediately like this:

$records = $model->find('all', compact('joins', 'fields', 'conditions', 'order', 'limit', 'offset'));
CakeLog::info("After Query");

then, cakelog will just output the sql log above After Query log and the sql will be formatted and highlighted.