Watchdog messages and string replacement Hello I would like to know which of the following ways (or some other) of logging messages is better and why.
I am writing lots of .install files since I create content types and fields programmatically and I often write statements as following:

$t = get_t();
watchdog('mymodule',$t('Field !field_name created.', array('!field_name' =&gt; $file_field_name)));


OR

$t = get_t();
watchdog('mymodule',$t('Field !field_name created.'), array('!field_name' =&gt; $file_field_name));


Note: in the first example I am doing string replacement in the $t function in the second in the watchdog() function.
Just use this:

watchdog('mymodule', 'Field !field_name created.', array('!field_name' =&gt; $file_field_name));


watchdog() function will translate the string you pass as the second parameter. You shouldn't translate the message before passing it to the watchdog().

Check out this answer for more information and references.

Or consult the following document from Drupal's documentation.