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

Missing option to disable logToFile #214

Closed
CMeldgaard opened this issue Dec 4, 2019 · 3 comments
Closed

Missing option to disable logToFile #214

CMeldgaard opened this issue Dec 4, 2019 · 3 comments

Comments

@CMeldgaard
Copy link

Im missing a option to disable logToFile in the abstract PaymentService class - i can see the idea when working locally, but because it logs to the silverstripe error log file, it also triggers Sentry error logging - meaning everytime a purchase is made i get 4 errors registered.

My suggestion would be to wrap $this->logToFile($output, $type); in a if-statement to check if config allows for logging.

@tractorcow
Copy link
Contributor

tractorcow commented Dec 12, 2019

You can probably try registering a NullLogger as the SilverStripe\Omnipay\Logger service.

I would really rather just have an option to throw exceptions rather than trying to mangle them (poorly) in code.

@tractorcow
Copy link
Contributor

---
Name: logging-payment
After:
  - '#omnipay-logging'
---
# Disable garbage logging
SilverStripe\Core\Injector\Injector:
  SilverStripe\Omnipay\Logger:
    class: 'Psr\Log\NullLogger'

@kinglozzer
Copy link
Member

I ran into the same issue (also with Sentry!) - options were to leave logging on and risk accidentally logging payment info in Sentry, or disable logging entirely and potentially leave exceptions un-reported. This is what I’ve come up with #229, and the config for it:

---
Name: payment-logging
After:
  - '#omnipay-logging'
---
SilverStripe\Core\Injector\Injector:
  SilverStripe\Omnipay\Logger:
    class: 'Psr\Log\NullLogger'
  SilverStripe\Omnipay\ExceptionLogger: '%$Psr\Log\LoggerInterface'

@wilr wilr closed this as completed Jul 8, 2023
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

No branches or pull requests

4 participants