PHPackages                             his/log - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. his/log

AbandonedLibrary[Logging &amp; Monitoring](/categories/logging)

his/log
=======

Hack Standard Interfaces for loggers

10

Since Mar 10Pushed 7y ago1 watchersCompare

[ Source](https://github.com/hack-interface-standards/log)[ Packagist](https://packagist.org/packages/his/log)[ RSS](/packages/his-log/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

RFC
---

[](#rfc)

Logger Interface
================

[](#logger-interface)

This document describes a common interface for logging libraries.

The main goal is to allow libraries to receive a `His\Log\LoggerInterface`object and write logs to it in a simple and universal way. Frameworks and CMSs that have custom needs MAY extend the interface for their own purpose, but SHOULD remain compatible with this document. This ensures that the third-party libraries an application uses can write to the centralized application logs.

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](http://tools.ietf.org/html/rfc2119).

The word `implementor` in this document is to be interpreted as someone implementing the `LoggerInterface` in a log-related library or framework. Users of loggers are referred to as `user`.

1. Specification
----------------

[](#1-specification)

### 1.1 Basics

[](#11-basics)

- The `LoggerInterface` exposes eight methods to write logs to the eight [RFC 5424](http://tools.ietf.org/html/rfc5424) levels (debug, info, notice, warning, error, critical, alert, emergency).
- A ninth method, `log`, accepts a log level as the first argument. Calling this method with one of the log level constants MUST have the same result as calling the level-specific method. Calling this method with a level not defined by this specification MUST throw a `His\Log\Exception\InvalidArgumentException`if the implementation does not know about the level. Users SHOULD NOT use a custom level without knowing for sure the current implementation supports it.

### 1.2 Message

[](#12-message)

- Every method accepts a string as the message. Implementors MAY have special handling for the passed objects. If that is not the case, implementors MUST cast it to a string.
- The message MAY contain placeholders which implementors MAY replace with values from the context array.

    Placeholder names MUST correspond to keys in the context array.

    Placeholder names MUST be delimited with a single opening brace `{` and a single closing brace `}`. There MUST NOT be any whitespace between the delimiters and the placeholder name.

    Placeholder names SHOULD be composed only of the characters `A-Z`, `a-z`, `0-9`, underscore `_`, and period `.`. The use of other characters is reserved for future modifications of the placeholders specification.

    Implementors MAY use placeholders to implement various escaping strategies and translate logs for display. Users SHOULD NOT pre-escape placeholder values since they can not know in which context the data will be displayed.

### 1.3 Context

[](#13-context)

- Every method accepts an array as context data. This is meant to hold any extraneous information that does not fit well in a string. The array can contain anything. Implementors MUST ensure they treat context data with as much lenience as possible. A given value in the context MUST NOT throw an exception nor raise any php error, warning or notice.
- If an `Exception` object is passed in the context data, it MUST be in the `'exception'` key. Logging exceptions is a common pattern and this allows implementors to extract a stack trace from the exception when the log backend supports it. Implementors MUST still verify that the `'exception'`key is actually an `Exception` before using it as such, as it MAY contain anything.

### 1.4 Helper classes and interfaces

[](#14-helper-classes-and-interfaces)

- The `His\Log\LogLevel` enum holds constants for the eight log levels.
- The `His\Log\LogLevelName` enum holds constants for naming the log levels;
- The `His\Log\LogLevelNameMap` provides a mapping method from the log level code to the name.

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3b4d307c7389996f8ffd03a3e9f1e6069f9726d0c72dc733ccd3d1230339e774?d=identicon)[his](/maintainers/his)

---

Top Contributors

[![usox](https://avatars.githubusercontent.com/u/5184763?v=4)](https://github.com/usox "usox (4 commits)")

---

Tags

hacklanghhvmhisinterfacesinteroperabilityloglogging

### Embed Badge

![Health badge](/badges/his-log/health.svg)

```
[![Health](https://phpackages.com/badges/his-log/health.svg)](https://phpackages.com/packages/his-log)
```

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M138](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[datadog/php-datadogstatsd

An extremely simple PHP datadogstatsd client

19124.6M15](/packages/datadog-php-datadogstatsd)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
