iTop icon indicating copy to clipboard operation
iTop copied to clipboard

Debug log for invalid placeholders

Open piRGoif opened this issue 4 years ago • 5 comments

This adds a debug log when a placeholder cannot be replaced.

This can happen for example in notifications, for a hyperlink() function for which we are specifying an invalid portal id : $this->hyperlink('non_existing_portal')$

Before the placeholder was just not replaced. Now we can enable a debug log on the LogChannels::NOTIFICATION channel.

Unfortunately the catch is done where we don't have the trigger / action context... But at least we will have more info than before !

piRGoif avatar Mar 29 '22 17:03 piRGoif

During technical review, we wanted to see if it was possible not to call Debug() method when the level isn't enabled. Indeed it is... but starting from 3.0.0 only :/ The \LogAPI::IsLogLevelEnabled was added in that version with N°3731, and is already called when simply logging (in \LogAPI::WriteLog). So nothing to be done in 3.0.0, and if we want to limit the logs in 2.7 we should simply update the LogAPI class in that branch.

piRGoif avatar May 03 '22 15:05 piRGoif

Sorry @piRGoif I just saw that comments from the last review where not submitted :/

Molkobain avatar May 03 '22 15:05 Molkobain

Discussed during technical review ! We agreed to change the log level : use Error instead of Debug

Ideally we could replace the placeholder with the error message, but that should be done deeper in the call stack... Also, a specific behavior when beeing on a isDevEnv instance could be triggered ? For now we are ok on simply adding a log :)

piRGoif avatar Jun 07 '22 15:06 piRGoif

rebased & force pushed to solve conflicts

piRGoif avatar Jun 07 '22 15:06 piRGoif

Functional review : OK, but for 2.7.8 / 3.0.2

piRGoif avatar Jun 14 '22 16:06 piRGoif