Peta
 All Classes Namespaces Functions Variables Pages
Public Member Functions | List of all members
Katzgrau\KLogger\Logger Class Reference
Inheritance diagram for Katzgrau\KLogger\Logger:

Public Member Functions

 __construct ($logDirectory, $logLevelThreshold=LogLevel::DEBUG)
 
 __destruct ()
 
 setDateFormat ($dateFormat)
 
 setLogLevelThreshold ($logLevelThreshold)
 
 log ($level, $message, array $context=array())
 
 write ($message)
 

Detailed Description

Finally, a light, permissions-checking logging class.

Originally written for use with wpSearch

Usage: $log = new Katzgrau('/var/log/', Psr::INFO); $log->info('Returned a million search results'); //Prints to the log file $log->error('Oh dear.'); //Prints to the log file $log->debug('x = 5'); //Prints nothing due to current severity threshhold

Author
Kenny Katzgrau katzg.nosp@m.rau@.nosp@m.gmail.nosp@m..com
Since
July 26, 2008 — Last update July 1, 2012 0.2.0 Class documentation

Constructor & Destructor Documentation

Katzgrau\KLogger\Logger::__construct (   $logDirectory,
  $logLevelThreshold = LogLevel::DEBUG 
)

Class constructor

Parameters
string$logDirectoryFile path to the logging directory
integer$logLevelThresholdThe LogLevel Threshold
Returns
void
Katzgrau\KLogger\Logger::__destruct ( )

Class destructor

Member Function Documentation

Katzgrau\KLogger\Logger::log (   $level,
  $message,
array  $context = array() 
)

Logs with an arbitrary level.

Parameters
mixed$level
string$message
array$context
Returns
null
Katzgrau\KLogger\Logger::setDateFormat (   $dateFormat)

Sets the date format used by all instances of KLogger

Parameters
string$dateFormatValid format string for date()
Katzgrau\KLogger\Logger::setLogLevelThreshold (   $logLevelThreshold)

Sets the Log Level Threshold

Parameters
string$dateFormatValid format string for date()
Katzgrau\KLogger\Logger::write (   $message)

Writes a line to the log without prepending a status or timestamp

Parameters
string$lineLine to write to the log
Returns
void

The documentation for this class was generated from the following file: