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

Bind Moodle $CFG->debug to $loggingenabled #141

Merged
merged 3 commits into from
Oct 6, 2017
Merged

Conversation

nadavkav
Copy link
Contributor

@nadavkav nadavkav commented Oct 5, 2017

Description
Turn on xapi_logstore file debugging when Moodle debugging is turned on.
(maybe this should go into os level standard logs as well, so it not bloating inside the folder?)

Related Issues
none

PR Type

  • Enhancement

Turn on xapi_logstore file debugging when Moodle debugging is turned on.
(maybe this should go into os level standard logs as well, so it not bloating inside the folder?)
Copy link
Contributor

@Nicosoft Nicosoft left a comment

Choose a reason for hiding this comment

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

Thank you @nadavkav
You just need to remove all spaces in line 69 and 74 because of Moodle coding style.

@@ -65,10 +65,16 @@ class store extends php_obj implements log_writer {
* @param log_manager $manager
*/
public function __construct(log_manager $manager) {
global $CFG;

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove all white spaces (Moodle coding style)

$this->helper_setup($manager);
$this->logguests = $this->get_config('logguests', 1);
$routes = $this->get_config('routes', '');
$this->routes = $routes === '' ? [] : explode(',', $routes);

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove all white spaces (Moodle coding style)

@nadavkav
Copy link
Contributor Author

nadavkav commented Oct 5, 2017

I removed the lines completely.

$this->helper_setup($manager);
$this->logguests = $this->get_config('logguests', 1);
$routes = $this->get_config('routes', '');
$this->routes = $routes === '' ? [] : explode(',', $routes);
if (!empty($CFG->debug) and $CFG->debug >= DEBUG_DEVELOPER) {
Copy link
Member

Choose a reason for hiding this comment

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

I might have used && instead of and to protect against future changes, since some people don't understand there's a slight difference in precedence between the two. Not too worried about that though, just something to be aware of 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I Agree, just used an old piece of code from another plugin I have.
Better fix it, at some point.

@ryasmi
Copy link
Member

ryasmi commented Oct 6, 2017

Thanks for your suggestion here @Nicosoft 👍

@ryasmi ryasmi merged commit 905d9fd into xAPI-vle:master Oct 6, 2017
@nadavkav
Copy link
Contributor Author

nadavkav commented Oct 6, 2017

BTW, was also thinking the logs should go to the standard php os level logs. here:
https://github.com/xAPI-vle/moodle-logstore_xapi/blob/master/classes/log/store.php#L17
Maybe use "error_log($message."\r\n", 1);"
And prefix $message with something like "logstore:",
so it can be filtered out when browsing the logs.
What do you think?

@ryasmi
Copy link
Member

ryasmi commented Oct 6, 2017

Hey @nadavkav, yeah that would be awesome 👍

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