How to log custom entries in 'Recent log entries'?
watchdog() is what you are looking for. See the description of its parameters, in particular these:


  $type: The category to which this message belongs. Can be any string, but the general practice is to use the name of the module calling watchdog(). The $type parameter is limited to 16 characters; anything longer is truncated.
  
  $severity: The severity of the message; one of the following values as defined in RFC 3164:
  
  
  WATCHDOG_EMERGENCY: Emergency, system is unusable.
  WATCHDOG_ALERT: Alert, action must be taken immediately.
  WATCHDOG_CRITICAL: Critical conditions.
  WATCHDOG_ERROR: Error conditions.
  WATCHDOG_WARNING: Warning conditions.
  WATCHDOG_NOTICE: (default) Normal but significant conditions.
  WATCHDOG_INFO: Informational messages.
  WATCHDOG_DEBUG: Debug-level messages.
  
  
  $link: A link to associate with the message.