Skip to content

Refresh Project #329

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
vendor/
*.swp
phpunit.xml
.idea
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
{
"name": "chrisboulton/php-resque",
"name": "spiritdead/php-resque",
Copy link
Contributor

Choose a reason for hiding this comment

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

This change cannot be merged. Always be sure to use a dedicated branch for PRs, and not to commit any changes to a PR branch that you don't intend to submit in the PR itself, as GitHub PRs are per branch, not per change set.

Copy link
Author

Choose a reason for hiding this comment

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

@danhunsaker sorry, was for upload in the packagist for my projects for use the composer to my github is the only way for apply my fixs, this project is outdated

Copy link
Author

@spiritdead spiritdead Feb 20, 2017

Choose a reason for hiding this comment

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

im creating a module for Yii2 framework, and i need make updates in this project and in the php-resque-scheduler

"type": "library",
"description": "Redis backed library for creating background jobs and processing them later. Based on resque for Ruby.",
"keywords": ["job", "background", "redis", "resque"],
"homepage": "http://www.github.com/chrisboulton/php-resque/",
"homepage": "http://www.github.com/spiritdead/php-resque/",
"license": "MIT",
"authors": [
{
"name": "Chris Boulton",
"email": "[email protected]"
},
{
"name": "Carlos Rodriguez",
"email": "[email protected]"
}
],
"repositories": [
Expand Down
19 changes: 12 additions & 7 deletions lib/Resque/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ class Resque_Log extends Psr\Log\AbstractLogger
{
public $verbose;

public function __construct($verbose = false) {
public $debug;
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at how this is applied, I think this isn't the correct name for this property.

Also, it would probably be better to adjust the existing property ->verbose instead of introducing a new parameter with non-configurable behavior.

I agree that being able to filter log entries would be immensely helpful for daily use. What I propose here, then, is to expand the valid values of the ->verbose property. Retaining the meanings of true and false to mean "everything" and "nothing", respectively, we could additionally support passing an array of PSR-3 log level constants/strings. Any log entry whose level is in the array is displayed; all others are skipped.

One thing to note, however, is that Resque_Log isn't meant to be used in most cases as the actual logger implementation, and will likely be dropped in a future release, in favor of a dependency on the PSR-3 virtual package. It's essentially only included for backwards compatibility while the project moves away from bundling dependencies. So you may wish to abandon this change entirely, in that light, and instead use a more capable PSR-3 logger implementation.

Copy link
Author

Choose a reason for hiding this comment

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

@danhunsaker i can understand that, was a temporary fix in my personal fork, maybe if is possible we can discuss for make a correct refresh of the project with namespace and more stuff


public function __construct($verbose = false, $debug = false) {
$this->verbose = $verbose;
$this->debug = $debug;
}

/**
Expand All @@ -32,12 +35,14 @@ public function log($level, $message, array $context = array())
return;
}

if (!($level === Psr\Log\LogLevel::INFO || $level === Psr\Log\LogLevel::DEBUG)) {
fwrite(
STDOUT,
'[' . $level . '] ' . $this->interpolate($message, $context) . PHP_EOL
);
}
if($this->debug) {
if (!($level === Psr\Log\LogLevel::INFO || $level === Psr\Log\LogLevel::DEBUG)) {
fwrite(
STDOUT,
'[' . $level . '] ' . $this->interpolate($message, $context) . PHP_EOL
);
}
}
}

/**
Expand Down