Is there a specific set of values that can go in $type or is it free text?

CommentFileSizeAuthor
#11 watchdog-D6.patch1.08 KBrdrh555
#8 782442-smallfix.patch1.16 KBjhodgdon
#7 782442-retry.patch1.16 KBAnonymous (not verified)
#5 782442.patch1.16 KBAnonymous (not verified)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon’s picture

Title: Documentation problem with watchdog » watchdog should document $type better
Version: 6.x-dev » 7.x-dev

Fixing title. Obviously if this user had this question, it isn't documented well enough that $type has to choose from the constants like WATCHDOG_ERROR that are at the top of includes/bootstrap.inc.

We should fix this in Drupal 7, and then back port to Drupal 6.

jhodgdon’s picture

Issue tags: +Novice

This would not be a bad project for a novice API doc contributor. My suggestion would be to put something like "a constant such as WATCHDOG_ERROR, WATCHDOG_WARNING, etc." in the $type param section. Those will turn into links.

xenophyle’s picture

I noticed there are two parameters that should be documented more completely: $type and $severity. Based on some user comments for the watchdog doc page, $severity is the one that needs to be chosen from WATCHDOG_ERROR, WATCHDOG_WARNING, etc. I found that $type can be anything you want, but it seems to be common practice to use the name of the module that is calling watchdog. Thanks for your quick response!

jhodgdon’s picture

You are correct - my mistake - $severity is the one that uses the constants, and $type is conventionally set to the module that is generating the error (but can be set to any string).

Anyway, still needs doc. :)

Anonymous’s picture

Status: Active » Needs review
FileSize
1.16 KB

Put something together from your suggestions. Take a peak!

jhodgdon’s picture

Status: Needs review » Needs work

This is close... A few wording/grammar/punctuation suggestions:

 * @param $type
 *   The category to which this message belongs, can be any string but
 *   general practice is to use the name of the module calling watchdog.

Punctuation:
... belongs. Can be any string, but...
Also, watchdog -> watchdog() [always put () after function names in docblocks]

 * @param $severity
 *   The severity of the message, as per RFC 3164. Possible contents are
 *   WATCHDOG_ERROR, WATCHDOG_WARNING, etc.

contents -> values

Anonymous’s picture

Status: Needs work » Needs review
FileSize
1.16 KB

Thanks for the input! Here it is again. :)

jhodgdon’s picture

FileSize
1.16 KB

How about this?

Dries’s picture

Status: Needs review » Fixed

Committed to CVS HEAD. Thanks.

jhodgdon’s picture

Version: 7.x-dev » 6.x-dev
Status: Fixed » Patch (to be ported)

This should probably be ported to 6.x.

rdrh555’s picture

Assigned: Unassigned » rdrh555
Status: Patch (to be ported) » Needs review
FileSize
1.08 KB
jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Patch applies cleanly and looks fine to me. Thanks!

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed. BTW the patch had dashes in place of underscores in WATCHDOG_* constant names, fixed that before committing.

Status: Fixed » Closed (fixed)
Issue tags: -Novice

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