The watchdog-show --tail command is a killer feature, but it lacks having an option to make it print full messages so it can really be useful on some scenarios. The suggested solution is to add an option called --full-message that shows the complete message of each entry.

A patch is being attached in the following comment.

Comments

juampynr’s picture

Status: Active » Needs review
StatusFileSize
new5.09 KB

The following patch allows message bodies to be fully printed by adding an option called --full-message to the watchdog-show command.

jonhattan’s picture

I can't remember why messages are truncated to 188 chars. It seems arbitrary.

What do you think about implementing --message-length= instead? It could default to 188 and let FALSE be the max length, so it could be invoked as wd-show --message-length to get the full length.

juampynr’s picture

I reviewed the patch and came up with a simpler patch. I did not like the new signature of the function that formats the message:

/**
 * Format a watchdog database row.
 *
 * @param $result
  *   Array. A database result object.
 * @param $full
 *   Boolean. Attach extra information about the message.
 * @param $full_message
 *   Boolean. Print the full message body or a truncated version.
 * @return
 *   Array. The result object with some attributes themed.
 */
function core_watchdog_format_result($result, $full = FALSE, $full_message = FALSE) {

So I replaced the new option --full-message by just --full and reused the existing variable. Now the signature makes much more sense:

/**
 * Format a watchdog database row.
 *
 * @param $result
 *   Array. A database result object.
 * @param $full
 *   Boolean. Add extended message details.
 * @return
 *   Array. The result object with some attributes themed.
 */
function core_watchdog_format_result($result, $full = FALSE) {
juampynr’s picture

Oops. Double posted. Apologies.

moshe weitzman’s picture

Status: Needs review » Needs work

Looks fine. Would be good to enance our unit test coverage for this.

moshe weitzman’s picture

Status: Needs work » Fixed

Decided to just commit this. Does not apply cleanly to 4.x so not committed there.

juampynr’s picture

Status: Fixed » Needs review
StatusFileSize
new4.21 KB

Here is a patch for 4.x.

moshe weitzman’s picture

Status: Needs review » Fixed

committed to 4.x

juampynr’s picture

Status: Fixed » Needs review
StatusFileSize
new1.97 KB

Here is a unit test for watchdog-show and watchdog-delete commands. It is for master branch.

I am also verifying here the --full option.

juampynr’s picture

And here is a test for the 4.x branch.

moshe weitzman’s picture

Status: Needs review » Fixed

Committed to both branches. Great work!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.