Skip to content

Okonomiyaki3000: _log returns the class instance for method chaining #43 #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 15, 2019

Conversation

hopeseekr
Copy link
Member

@hopeseekr hopeseekr commented May 15, 2019

Copied from ccampbell/chromephp#43:

So that you can do stuff like:

ChromePhp::group('Some Logs')
    ->log('A log message')
    ->log('Another log message')
    ->log('This can go on as long as you like.')
    ->groupEnd();

Which I think is pretty slick.

This merges ccampbell/chromephp/pull/43.


This change is Reviewable

Copy link
Member Author

@hopeseekr hopeseekr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We love fluent interfaces! Hurray!

foreach ($args as $arg) {
$logs[] = $logger->_convert($arg);
}
$logs = array_map(array($logger, '_convert'), $args);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the array syntax should be short syntax because of consistency. Using the [....] instead.

And this short syntax is supported sine the php-5.4+.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in PR #6.


$backtrace = debug_backtrace(false);
$level = $logger->getSetting(self::BACKTRACE_LEVEL);

$backtrace_message = 'unknown';
if (isset($backtrace[$level]['file']) && isset($backtrace[$level]['line'])) {
if (isset($backtrace[$level]['file'], $backtrace[$level]['line'])) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is about two styles for presenting check two values will be set.

If we accept this, we should change all related conditions to this in this respo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants