Class Log_file

Description

The Log_file class is a concrete implementation of the Log abstract class that logs messages to a text file.

Located in /maintenance/libraries/pear/Log/file.php (line 20)

Log
   |
   --Log_file
Variable Summary
 boolean $_append
 string $_eol
 string $_filename
 array $_formatMap
 resource $_fp
 string $_lineFormat
 integer $_mode
 string $_timeFormat
Method Summary
 Log_file Log_file (string $name, [string $ident = ''], [array $conf = array()], [int $level = PEAR_LOG_DEBUG])
 void close ()
 void flush ()
 boolean log (mixed $message, [string $priority = null])
 void open ()
 void _Log_file ()
 True _mkpath (string $path, [integer $mode = 0700])
Variables
boolean $_append = true (line 42)

Should new log entries be append to an existing log file, or should the

a new log file overwrite an existing one?

  • access: private
string $_eol = "\n" (line 84)

String containing the end-on-line character sequence.

  • access: private
string $_filename = 'php.log' (line 27)

String containing the name of the log file.

  • access: private
array $_formatMap = array('%{timestamp}' => '%1$s',
'%{ident}' => '%2$s',
'%{priority}' => '%3$s',
'%{message}' => '%4$s',
'%\{' => '%%{')
(line 73)

Hash that maps canonical format keys to position arguments for the "line format" string.

  • access: private
resource $_fp = false (line 34)

Handle to the log file.

  • access: private
string $_lineFormat = '%1$s %2$s [%3$s] %4$s' (line 56)

String containing the format of a log line.

  • access: private
integer $_mode = 0644 (line 49)

Integer (in octal) containing the log file's permissions mode.

  • access: private
string $_timeFormat = '%b %d %H:%M:%S' (line 65)

String containing the timestamp format. It will be passed directly to strftime(). Note that the timestamp string will generated using the current locale.

  • access: private

Inherited Variables

Inherited from Log

Log::$_id
Log::$_ident
Log::$_listeners
Log::$_mask
Log::$_opened
Log::$_priority
Methods
Constructor Log_file (line 95)

Constructs a new Log_file object.

  • access: public
Log_file Log_file (string $name, [string $ident = ''], [array $conf = array()], [int $level = PEAR_LOG_DEBUG])
  • string $name: Ignored.
  • string $ident: The identity string.
  • array $conf: The configuration array.
  • int $level: Log messages up to and including this level.
close (line 218)

Closes the log file if it is open.

  • access: public
void close ()

Redefinition of:
Log::close()
Abstract implementation of the close() method.
flush (line 234)

Flushes all pending data to the file handle.

  • since: Log 1.8.2
  • access: public
void flush ()

Redefinition of:
Log::flush()
Abstract implementation of the flush() method.
log (line 251)

Logs $message to the output window. The message is also passed along to any Log_observer instances that are observing this Log.

  • return: True on success or false on failure.
  • access: public
boolean log (mixed $message, [string $priority = null])
  • mixed $message: String or object containing the message to log.
  • string $priority: The priority of the message. Valid values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT, PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING, PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.

Redefinition of:
Log::log()
Abstract implementation of the log() method.
open (line 193)

Opens the log file for output. If the specified log file does not already exist, it will be created. By default, new log entries are appended to the end of the log file.

This is implicitly called by log(), if necessary.

  • access: public
void open ()

Redefinition of:
Log::open()
Abstract implementation of the open() method.
_Log_file (line 133)

Destructor

void _Log_file ()
_mkpath (line 153)

Creates the given directory path. If the parent directories don't already exist, they will be created, too.

  • return: if the full path is successfully created or already exists.
  • access: private
True _mkpath (string $path, [integer $mode = 0700])
  • string $path: The full directory path to create.
  • integer $mode: The permissions mode with which the directories will be created.

Inherited Methods

Inherited From Log

 Log::alert()
 Log::attach()
 Log::close()
 Log::crit()
 Log::debug()
 Log::detach()
 Log::emerg()
 Log::err()
 Log::factory()
 Log::flush()
 Log::getIdent()
 Log::getMask()
 Log::getPriority()
 Log::info()
 Log::isComposite()
 Log::log()
 Log::MASK()
 Log::notice()
 Log::open()
 Log::priorityToString()
 Log::setIdent()
 Log::setMask()
 Log::setPriority()
 Log::singleton()
 Log::UPTO()
 Log::warning()
 Log::_announce()
 Log::_extractMessage()
 Log::_isMasked()

Documentation generated on Fri, 3 Dec 2004 12:26:44 +0000 by phpDocumentor 1.3.0RC3