itsgoingd / clockwork-chrome

Clockwork - php dev tools integrated to your browser - Chrome extension
https://underground.works/clockwork
411 stars 25 forks source link

Logging #1

Closed dennieriechelman closed 11 years ago

dennieriechelman commented 11 years ago

Hi. First of all my compliments. This is really awesome. I love the ease to check your sql queries!

There is a log tab in the chrome extension dev tools. However I found no info about this. Is there something like a log method?

dennieriechelman commented 11 years ago

Ah I oversaw this: https://github.com/itsgoingd/clockwork/wiki/Development-notes .

The log method is not something to use in you code to trace variables etc right?

itsgoingd commented 11 years ago

Hey, if you are using Laravel you can simply use the standard L4 Log class, Clockwork will show these messages automatically.

If you are using different framework, you can manually create a Clockwork\Request\Log instance and assign the data into the request object log attribute before storing the request data, example:

$log = new Clockwork\Request\Log();
$log->log(Clockwork\Request\Log::INFO, 'Log message.');

$clockwork->getRequest()->log = $log->toArray();
$clockwork->storeRequest();

This is a great way to debug variable values without breaking app output, just keep in mind only string log messages are supported atm, so you need to use something like print_r if you want to log arrays or objects. Native support for these variable types is planned in future versions.

dennieriechelman commented 11 years ago

OMG. After almost one year of Laravel I now find out about logging.... How many times I must have read the manuel.

Thanks for the explanation! You rock.