original_string: public static function log($pMessage)
      {
          if (is_array($pMessage) or is_object($pMessage)) {
              $message = json_encode($pMessage);
          } else {
              $message = (string)$pMessage;
          }
  
          $logId = mt_rand();
  
          if (Agl::isInitialized()) {
              $message = '[agl_' . $logId . '] [' . date('Y-m-d H:i:s') . '] [' . APP_PATH . '] ' . $message . "\n";
  
              $dir = APP_PATH . Agl::APP_VAR_DIR . sprintf(self::LOG_DIR, date('Y'), date('m'));
              if (! is_writable(APP_PATH . Agl::APP_VAR_DIR) or (! is_dir($dir) and ! mkdir($dir, 0777, true)) or ! is_writable($dir)) {
                  return 0;
              }
  
              $file   = $dir . sprintf(self::LOG_FILE, date('Y-m-d'));
              $logged = FileData::write($file, $message, true);
  
              if (! $logged) {
                  return 0;
              }
          } else {
              return 0;
          }
  
          return $logId;
      }
code: public static function log($pMessage)
      {
          if (is_array($pMessage) or is_object($pMessage)) {
              $message = json_encode($pMessage);
          } else {
              $message = (string)$pMessage;
          }
  
          $logId = mt_rand();
  
          if (Agl::isInitialized()) {
              $message = '[agl_' . $logId . '] [' . date('Y-m-d H:i:s') . '] [' . APP_PATH . '] ' . $message . "\n";
  
              $dir = APP_PATH . Agl::APP_VAR_DIR . sprintf(self::LOG_DIR, date('Y'), date('m'));
              if (! is_writable(APP_PATH . Agl::APP_VAR_DIR) or (! is_dir($dir) and ! mkdir($dir, 0777, true)) or ! is_writable($dir)) {
                  return 0;
              }
  
              $file   = $dir . sprintf(self::LOG_FILE, date('Y-m-d'));
              $logged = FileData::write($file, $message, true);
  
              if (! $logged) {
                  return 0;
              }
          } else {
              return 0;
          }
  
          return $logId;
      }
code_tokens: public static function log ( $ pMessage ) { if ( is_array ( $ pMessage ) or is_object ( $ pMessage ) ) { $ message = json_encode ( $ pMessage ) ; } else { $ message = ( string ) $ pMessage ; } $ logId = mt_rand ( ) ; if ( Agl :: isInitialized ( ) ) { $ message = '[agl_' . $ logId . '] [' . date ( 'Y-m-d H:i:s' ) . '] [' . APP_PATH . '] ' . $ message . "\n" ; $ dir = APP_PATH . Agl :: APP_VAR_DIR . sprintf ( self :: LOG_DIR , date ( 'Y' ) , date ( 'm' ) ) ; if ( ! is_writable ( APP_PATH . Agl :: APP_VAR_DIR ) or ( ! is_dir ( $ dir ) and ! mkdir ( $ dir , 0777 , true ) ) or ! is_writable ( $ dir ) ) { return 0 ; } $ file = $ dir . sprintf ( self :: LOG_FILE , date ( 'Y-m-d' ) ) ; $ logged = FileData :: write ( $ file , $ message , true ) ; if ( ! $ logged ) { return 0 ; } } else { return 0 ; } return $ logId ; }
docstring: Log a message in the syslog.
  
  @param string $pMessage
  @return null|string
docstring_tokens: Log a message in the syslog .