Skip to content
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

Generic LogCategory::log($level, $args) #4

Merged
merged 2 commits into from
Jan 2, 2014

Conversation

thekid
Copy link
Member

@thekid thekid commented Dec 28, 2013

This pull request adds a generic log() method to util.log.LogCategory which accepts the log level and an array of arguments. This method is the same as the previos protected callAppenders() method, only now public and with a more generic name, so no additional overhead is added.

With this in place, we can easily log events given a level and arguments instead of having to resort to call_user_func. An example where this would be useful can be seen in xp-forge/mustache#1:

{{log info "Look at me!"}}
$engine= create(new MustacheEngine())->withHelpers(array(
  'log' => function($in, $context, $options) use($cat) {
    $cat->log(LogLevel::named($options[0]), array_slice($options, 1));
    return '';  // Remove
  }
);

thekid added a commit that referenced this pull request Jan 2, 2014
@thekid thekid merged commit 3d08e4d into master Jan 2, 2014
thekid added a commit that referenced this pull request Jan 2, 2014
thekid added a commit to xp-forge/handlebars that referenced this pull request Jan 2, 2014
@thekid thekid deleted the category-generic-log-method branch January 2, 2014 18:26
@ghost ghost assigned thekid Jan 2, 2014
@thekid thekid modified the milestone: 6.0.0 May 6, 2014
thekid added a commit to xp-forge/handlebars that referenced this pull request Oct 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant