Is there a drupal function to clear the watchdog log inside a module?
The best way to do this is via drush:
$ drush help watchdog-delete Delete watchdog messages. Arguments or options must be provided to specify which messages to delete. Examples: drush watchdog-delete all Delete all messages. drush watchdog-delete 64 Delete messages with id 64. drush watchdog-delete "cron run Delete messages containing the string "cron run succesful". succesful" drush watchdog-delete --severity=notice Delete all messages with a severity of notice. drush watchdog-delete --type=cron Delete all messages of type cron. Arguments: severity Delete messages of a given severity level. type Delete messages of a given type. Aliases: wd-del, wd-delete
add -y to command: drush watchdog-delete all
==> drush watchdog-delete all -y