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

Log level configuration for 2.0.x #29

Merged
merged 1 commit into from
Oct 9, 2019
Merged

Conversation

halles
Copy link
Contributor

@halles halles commented Oct 4, 2019

Added configuration for minimal log level config on 2.0.x

Parameter name is the same as what has been implemented for 3.0.x

Update README accordingly.

@phptek
Copy link
Owner

phptek commented Oct 4, 2019

OK, I ran a few tests and it works well - thanks! I have added a few comments inline. Once you've fixed those up, can you please squash all your commits into a single one and force-push the feature-branch? Cheers :-)

@halles
Copy link
Contributor Author

halles commented Oct 6, 2019

@phptek this is failing to build do to a silverstripe cms recipe not being available anymore. This tag seems to be two years old. Would you like me to patch that pipeline?

@phptek
Copy link
Owner

phptek commented Oct 7, 2019

Sure! Just needs to be the minimum version that composer will work with.

@phptek
Copy link
Owner

phptek commented Oct 7, 2019

I'm still not sure under what circumstances one might run this task. Can you explain? If it's still required, it should probably be restricted to running only with a permissioned user.

@halles
Copy link
Contributor Author

halles commented Oct 7, 2019

@phptek this is not the task 🤔

@halles
Copy link
Contributor Author

halles commented Oct 7, 2019

@phptek could you rerun this pipeline? It should be ready to merge now :)

Copy link
Owner

@phptek phptek left a comment

Choose a reason for hiding this comment

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

@phptek this is not the task

Not sure what you mean here.

This original PR was about adding a TestConnectionTask. I originally blindly looked at it using my phone, but now I'm looking at it from my lappy, I'm struggling to imagine how this task is used. What's the use case exactly?

foreach (Logger::getLevels() as $name => $value) {
$func = strtolower($name);
$logger->$func('Testing Severity Level: ' . $name);
printf("Security Level: %s <br/>\n", $name);
Copy link
Owner

Choose a reason for hiding this comment

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

A <br> element is hard-coded here, but that won't suit CLI users (I very rarely use the browser to run BuildTasks). I usully include something like this in my tasks that spits out newlines suited to the current PHP SAPI:

public function output(string $message)
{
    $newLine = Director::is_cli() ? PHP_EOL : '<br/>';
    printf($message . $newLine);
}

Comment on lines 12 to 16
protected $title = 'Test Sentry Configuration';

protected $description = 'Captures message for all levels available';
Copy link
Owner

Choose a reason for hiding this comment

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

Minor point, but one I am fairly retentive on - docblocks. A single /** @var string */ to cover both works for me :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

FYI a single one won't cover both for tooling & IDEs ;)

Comment on lines 47 to 48
$log_level = Config::inst()->get(self::class, 'log_level');

$level = ($log_level) ? constant(Logger::class . '::'. $log_level) : $level;
Copy link
Owner

Choose a reason for hiding this comment

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

Minor point, but there's no need for a newline here.

@halles
Copy link
Contributor Author

halles commented Oct 8, 2019

@phptek got confused between PRs.

This PR is both the log_level config availability and the task to test successful Sentry connection. Basically is to test that Sentry is working before the app shoot an exception.

Allos override of minimum reporting level
Add Task that tests Sentry Link
Change config parameter name
Specific comment for differences in versions 2 & 3
Sentry Testing Task
Add all emergency levels available to options
Change Namespace to correct one
Default `log_level` set to `WARNING`
Add output with new line wrapper. Removes unnecessary new lines.
@phptek phptek merged commit ce56004 into phptek:master Oct 9, 2019
phptek pushed a commit that referenced this pull request Jul 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants