You are here

function filelog_filename in File Log 7

Same name and namespace in other branches
  1. 6 filelog.module \filelog_filename()
1 call to filelog_filename()
filelog_watchdog in ./filelog.module
Implementation of hook_watchdog().

File

./filelog.module, line 151
Writes logging messages into files.

Code

function filelog_filename($entry) {
  $f = _filelog_get_conf();
  $name = array();
  if ($f['site_in_name']) {
    $name[] = $f['site_in_name'] === TRUE ? array_pop(explode('/', conf_path())) : $f['site_in_name'];
  }
  $name[] = $f['type_in_name'] ? preg_replace('|\\s+|', '_', $entry['type']) : 'watchdog';
  if ($f['daily_files']) {
    $name[] = format_date(REQUEST_TIME, 'custom', 'Ymd');
  }
  if ($f['severity_in_name']) {
    $name[] = _filelog_decode_severity($entry['severity']);
  }
  else {
    if ($f['grouped_severity_in_name']) {
      switch ($entry['severity']) {
        case WATCHDOG_DEBUG:
          $name[] = 'debug';
          break;
        case WATCHDOG_INFO:
        case WATCHDOG_NOTICE:
        case WATCHDOG_WARNING:
          $name[] = 'info';
          break;
        case WATCHDOG_ERROR:
        case WATCHDOG_CRITICAL:
        case WATCHDOG_ALERT:
        case WATCHDOG_EMERG:
          $name[] = 'error';
          break;
      }
    }
  }
  $name[] = 'log';
  return implode('.', $name);
}