-
Notifications
You must be signed in to change notification settings - Fork 7
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
SyncEmitter produce output in debug mode #271
Comments
I see 2 possible solutions: 1. Extend SyncEmitterclass SophiEmitter extends Snowplow\Tracker\Emitters\SyncEmitter {
const DEBUG_LOG_FILES = false;
} then replace SyncEmitter with SophiEmitter here: 2. Suppress all output in debug modeAdd a conditional ob_start / ob_end_clean wrapper for $tracker->trackUnstructEvent in: |
Solution 1 will not work: the Snowplow\Tracker\Emitter is using self::DEBUG_LOG_FILES to read the const, in this case it always be if (self::DEBUG_LOG_FILES) {
if ($this->initDebug($type) !== true) {
$this->write_perms = false;
print_r("Unable to create debug log files: invalid write permissions.");
}
} |
Looks like it's still possible to extend |
So, as the result, we need to combine both solutions:
|
@cadic great triage on this, similarly confirming this also impacts publishing (not just updating as Mather-Sophi/sp-debug-bar-for-sophi#13 notes) |
Describe the bug
Initially reported in Mather-Sophi/sp-debug-bar-for-sophi#13
Happens when
sophi_tracker_emitter_debug
is true (f.e. using Debug Bar for Sophi plugin)AND
The directory
vendor/snowplow/snowplow-tracker/debug
isn't writableWhen the SyncEmitter being created with
$debug = true
attribute, it will also try to write logs in the hardcoded path:https://github.com/snowplow/snowplow-php-tracker/blob/32a08e9a7c25d1c51621751e1cdfcffcdef6cfe5/src/Emitter.php#L377-L379
If the path is not writable, Emitter will print the debug information
https://github.com/snowplow/snowplow-php-tracker/blob/32a08e9a7c25d1c51621751e1cdfcffcdef6cfe5/src/Emitter.php#L60-L65
Steps to Reproduce
Refer to the initial report: Mather-Sophi/sp-debug-bar-for-sophi#13
Screenshots, screen recording, code snippet
No response
Environment information
No response
WordPress information
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: