$log API variable / WireLog class

Enables creation of logs, logging of events, and management of logs.

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the WireLog class also inherits all the methods and properties of: Wire.

Show $var?             Show args?        

Common

NameReturnSummary 
$log->error(string $text)
Wire WireLogRecord an error message in the error log (errors.txt) 
$log->message(string $text)
Wire WireLogRecord an informational or 'success' message in the message log (messages.txt) 
$log->save(string $name, string $text)
boolSave text to a named log
$log->warning(string $text)
Wire WireLogRecord a warning message in the warnings log (warnings.txt) 

Retrieval

NameReturnSummary 
$log->getEntries(string $name)
arrayReturn given number of entries from end of log file, with each entry as an associative array of components 
$log->getFilename(string $name)
stringGet the full filename (including path) for the given log name 
$log->getLines(string $name)
arrayReturn the given number of entries from the end of log file 
$log->getLogs()
arrayReturn array of all logs, sorted by name 
$log->getTotalEntries(string $name)
intGet the total number of entries present in the given log 

Manipulation

NameReturnSummary 
$log->delete(string $name)
boolDelete a log file 
$log->prune(string $name, int $days)
intPrune log file to contain only entries from last [n] days 

Additional methods and properties

In addition to the methods and properties above, WireLog also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.137

Twitter updates

  • ProcessWire 3.0.144 and 3.0.145 add improved field template context override settings and include a new Inputfields API, along with numerous other issue fixes, optimizations and improvements to the core. More
    8 November 2019
  • ProcessWire 3.0.144 core updates: Upgraded overrides section in the field editor, a new Inputfields JS API, and more— More
    1 November 2019
  • ProcessWire 3.0.143 core updates — 26 commits and 18 resolved issue reports, plus some other useful improvements and additions. More here: More
    25 October 2019

Latest news

  • ProcessWire Weekly #287
    In the 287th issue of ProcessWire Weekly we'll talk a bit about the latest core versions 3.0.144 and 3.0.145, introduce a third party module called Sanitizer EasySlugger, and publish a new #processwireworks poll. Read on!
    Weekly.pw / 9 November 2019
  • ProcessWire 3.0.145 core updates
    ProcessWire 3.0.144 and 3.0.145 add improved field template context override settings and include a new Inputfields API, along with numerous other issue fixes, optimizations and improvements to the core.
    Blog / 8 November 2019
  • Subscribe to weekly ProcessWire news

“Yesterday I sent the client a short documentation for their ProcessWire-powered website. Today all features already used with no questions. #cmsdoneright—Marc Hinse, Web designer/developer