Jump to content

\IPS\Log::log()


Tom S.
 Share

Go to solution Solved by Ryan Ashbrook,

Recommended Posts

It's great that we can set up our own logging with \IPS\Log::log().

How can I log an error to the Error Logs instead of System logs?

The trouble I have right now with \IPS\Log::log() is that it has no level of severity. So I cannot distinguish between warnings, errors, critical errors...

I have noticed that errors that appear in the Error Logs trigger a notification in the ACP. So right now I see System Logs as a place for warnings and Error Logs as a place for critical errors that require more attention.

I don't think this is ideal though. It would be nice if we could set a severity level with our logs. And depending on the severity, a notification could be triggered.

And while on the subject of notification. It would be nice if you could set up rules such as, "If X amount of errors happen within 10 minutes, send an email/sms or whatever...

Link to comment
Share on other sites

  • Solution

They are two different things - the Error Logs are errors that are shown to end users, and have a severity of 1-5. What actually gets logged depends on what the community has configured.

See here: 

The System Logs, however, are for debugging purposes. You'll almost always want to use \IPS\Log::debug() as that will only log when DEBUG_LOG is set in constants.php. \IPS\Log::log() will always log, and should be used sparingly, so as to avoid filling it up unnecessarily:

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...