lucite/mocklogger

Maintainers

Package info

github.com/octoth0rpe/LuciteMockLogger

pkg:composer/lucite/mocklogger

Statistics

Installs: 8

Dependents: 2

Suggesters: 0

Stars: 0

Open Issues: 0

v0.0.3 2024-09-24 06:39 UTC

This package is auto-updated.

Last update: 2026-03-24 09:59:58 UTC


README

A simple psr3 implementation meant for unit testing.

Installation

composer require lucite/mocklogger

Usage

Instead of writing messages somewhere, all messages are pushed onto an array (->logs). Messages are prepended with [$LEVEL] where $LEVEL is the all caps name of the function used to log the message. The $context arg is simply json_encoded and appended onto the message.

There are a number of handy utility functions that could be useful for testing:

  • ->count() returns the number of messages that have been logged.
  • ->reset() clears the log array.
  • ->last() returns the most recently logged message