0

I'm following this monolog tutorial and the example with trying to send a critical log via email using Swift. monolog+swift_tutorial

i've copied the code exactly, which is located under heading Handler order in the tutorial link. I've changed the username and password and email information to my gmail account to send an email to myself etc. However i recieve this error with this statement:

$logger->addCritical('Hey, a critical log entry!');

And recieve the following error:

Fatal error: Uncaught Error: Call to undefined method Monolog\Logger::addCritical()

I'm using Monolog version: "^2" in my composer.json

So this means the function doesn't exist, so i searched for the function in google, and found other examples of people using this method for their monolog instances, however when i try to use it, as the tutorial shows, i receive undefined method. Could this be an issue with my monolog version? I've also updated everything with composer.

digitalXmage
  • 23
  • 1
  • 7
  • It looks like it exists in [v1.x](https://github.com/Seldaek/monolog/blob/1.x/src/Monolog/Logger.php), but not [v2/master](https://github.com/Seldaek/monolog/blob/master/src/Monolog/Logger.php) – aynber Dec 23 '19 at 15:34
  • @aynber thank you for finding out, is there a way to use the function, or is there an alternative function for v2? – digitalXmage Dec 23 '19 at 15:56
  • Try `$logger->critical('Hey, a critical log entry!');` From their GitHub page, it looks like that should work. – aynber Dec 23 '19 at 16:04

0 Answers0