phpDocumentor Log
[ class tree: Log ] [ index: Log ] [ all elements ]

Class: Log_file

Source Location: /lodel/scripts/PEAR/Log/file.php

Class Log_file

Class Overview

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

Located in /lodel/scripts/PEAR/Log/file.php [line 20]

Log
   |
   --Log_file
Author(s): API Tags:
Example:  example not found

Information Tags:
Since:  Log 1.0

Properties

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From Log

Log::$_formatMap
Log::$_id
Log::$_ident
Log::$_listeners
Log::$_mask
Log::$_opened
Log::$_priority

Inherited From Log

Log::alert()
A convenience function for logging an alert event. It will log a message at the PEAR_LOG_ALERT log level.
Log::attach()
Adds a Log_observer instance to the list of observers that are listening for messages emitted by this Log instance.
Log::close()
Abstract implementation of the close() method.
Log::crit()
A convenience function for logging a critical event. It will log a message at the PEAR_LOG_CRIT log level.
Log::debug()
A convenience function for logging a debug event. It will log a message at the PEAR_LOG_DEBUG log level.
Log::detach()
Removes a Log_observer instance from the list of observers.
Log::emerg()
A convenience function for logging a emergency event. It will log a message at the PEAR_LOG_EMERG log level.
Log::err()
A convenience function for logging a error event. It will log a message at the PEAR_LOG_ERR log level.
Log::factory()
Attempts to return a concrete Log instance of type $handler.
Log::flush()
Abstract implementation of the flush() method.
Log::getIdent()
Returns the current identification string.
Log::getMask()
Returns the current level mask.
Log::getPriority()
Returns the current default priority.
Log::info()
A convenience function for logging a information event. It will log a message at the PEAR_LOG_INFO log level.
Log::isComposite()
Indicates whether this is a composite class.
Log::log()
Abstract implementation of the log() method.
Log::MASK()
Calculate the log mask for the given priority.
Log::MAX()
Calculate the log mask for all priorities less than or equal to the given priority. In other words, $priority will be the highests priority matched by the resulting mask.
Log::MIN()
Calculate the log mask for all priorities greater than or equal to the given priority. In other words, $priority will be the lowest priority matched by the resulting mask.
Log::notice()
A convenience function for logging a notice event. It will log a message at the PEAR_LOG_NOTICE log level.
Log::open()
Abstract implementation of the open() method.
Log::priorityToString()
Returns the string representation of a PEAR_LOG_* integer constant.
Log::setIdent()
Sets this Log instance's identification string.
Log::setMask()
Set and return the level mask for the current Log instance.
Log::setPriority()
Sets the default priority to the specified value.
Log::singleton()
Attempts to return a reference to a concrete Log instance of type $handler, only creating a new instance if no log instance with the same parameters currently exists.
Log::stringToPriority()
Returns the the PEAR_LOG_* integer constant for the given string representation of a priority name. This function performs a case-insensitive search.
Log::UPTO()
Calculate the log mask for all priorities up to the given priority.
Log::warning()
A convenience function for logging a warning event. It will log a message at the PEAR_LOG_WARNING log level.
Log::_announce()
Informs each registered observer instance that a new message has been logged.
Log::_extractMessage()
Returns the string representation of the message data.
Log::_format()
Produces a formatted log line based on a format string and a set of variables representing the current log record and state.
Log::_getBacktraceVars()
Using debug_backtrace(), returns the file, line, and enclosing function name of the source code context from which log() was invoked.
Log::_isMasked()
Check if the given priority is included in the current level mask.

[ Top ]
Property Summary
boolean   $_append   Should new log entries be append to an existing log file, or should the
integer   $_dirmode   Integer (in octal) specifying the file permission mode that will be used when creating directories that do not already exist.
string   $_eol   String containing the end-on-line character sequence.
string   $_filename   String containing the name of the log file.
resource   $_fp   Handle to the log file.
string   $_lineFormat   String containing the format of a log line.
boolean   $_locking   Should advisory file locking (i.e., flock()) be used?
integer   $_mode   Integer (in octal) containing the log file's permissions mode.
string   $_timeFormat   String containing the timestamp format. It will be passed directly to strftime(). Note that the timestamp string will generated using the current locale.

[ Top ]
Method Summary
Log_file   Log_file()   Constructs a new Log_file object.
void   close()   Closes the log file if it is open.
void   flush()   Flushes all pending data to the file handle.
boolean   log()   Logs $message to the output window. The message is also passed along to any Log_observer instances that are observing this Log.
void   open()   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.
void   _Log_file()   Destructor
True   _mkpath()   Creates the given directory path. If the parent directories don't already exist, they will be created, too.

[ Top ]
Properties
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?

API Tags:
Access:  private


[ Top ]
integer   $_dirmode = 0755 [line 64]

Integer (in octal) specifying the file permission mode that will be used when creating directories that do not already exist.

API Tags:
Access:  private


[ Top ]
string   $_eol = "\n" [line 87]

String containing the end-on-line character sequence.

API Tags:
Access:  private


[ Top ]
string   $_filename = 'php.log' [line 27]

String containing the name of the log file.

API Tags:
Access:  private


[ Top ]
resource   $_fp = false [line 34]

Handle to the log file.

API Tags:
Access:  private


[ Top ]
string   $_lineFormat = '%1$s %2$s [%3$s] %4$s' [line 71]

String containing the format of a log line.

API Tags:
Access:  private


[ Top ]
boolean   $_locking = false [line 49]

Should advisory file locking (i.e., flock()) be used?

API Tags:
Access:  private


[ Top ]
integer   $_mode = 0644 [line 56]

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

API Tags:
Access:  private


[ Top ]
string   $_timeFormat = '%b %d %H:%M:%S' [line 80]

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

API Tags:
Access:  private


[ Top ]
Methods
Constructor Log_file  [line 98]

  Log_file Log_file( string $name, [string $ident = ''], [array $conf = array()], [int $level = PEAR_LOG_DEBUG]  )

Constructs a new Log_file object.

Parameters:
string   $name:  Ignored.
string   $ident:  The identity string.
array   $conf:  The configuration array.
int   $level:  Log messages up to and including this level.

API Tags:
Access:  public


[ Top ]
close  [line 235]

  void close( )

Closes the log file if it is open.


API Tags:
Access:  public


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

[ Top ]
flush  [line 251]

  void flush( )

Flushes all pending data to the file handle.


API Tags:
Access:  public

Information Tags:
Since:  Log 1.8.2

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

[ Top ]
log  [line 272]

  boolean log( mixed $message, [string $priority = null]  )

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

Parameters:
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.

API Tags:
Return:  True on success or false on failure.
Access:  public


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

[ Top ]
open  [line 204]

  void open( )

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.


API Tags:
Access:  public


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

[ Top ]
_Log_file  [line 152]

  void _Log_file( )

Destructor



[ Top ]
_mkpath  [line 174]

  True _mkpath( string $path, [integer $mode = 0700]  )

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

This implementation is inspired by Python's os.makedirs function.

Parameters:
string   $path:  The full directory path to create.
integer   $mode:  The permissions mode with which the directories will be created.

API Tags:
Return:  if the full path is successfully created or already exists.
Access:  private


[ Top ]

Documentation generated on Thu, 10 Jul 2008 05:07:31 +0200 by phpDocumentor 1.4.0a2