PHPackages                             phpgt/logger - 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. phpgt/logger

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

phpgt/logger
============

PSR-3 logger and implementation.

v1.1.0(3mo ago)04.8k↑300%[2 issues](https://github.com/PhpGt/Logger/issues)[2 PRs](https://github.com/PhpGt/Logger/pulls)2MITPHPPHP &gt;=8.1CI passing

Since Sep 21Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/PhpGt/Logger)[ Packagist](https://packagist.org/packages/phpgt/logger)[ GitHub Sponsors](https://github.com/sponsors/PhpGt)[ RSS](/packages/phpgt-logger/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (4)Dependencies (2)Versions (9)Used By (2)

Simple logger for PHP applications.
===================================

[](#simple-logger-for-php-applications)

Start logging with zero configuration. By default, the logger writes to standard output, so `Log::error("You can't do that");` is all you need to get started. When you need to, you can configure the logger to send logs to different file or stream sources.

The aim of this library is minimalism. There are no large configuration objects or transport layers to learn first. We get a set of familiar log levels, a small handler system, and a straightforward way to route messages where they need to go.

Log levels
----------

[](#log-levels)

This library uses the standard \[PSR-3\]\[psr3\] level names. This means that throughout your code, you can decide to log at the levels listed below, and your environment can decide the minimum log level to report. For instance, it would probably be too verbose to log debug information on a production server. This is consistent with the \[Syslog protocol\]\[syslog\].

- `debug` - Detailed debugging information.
- `info` - Interesting events.
- `notice` - Normal, but significant events.
- `warning` - Exceptional occurrences that are not errors.
- `error` - Runtime errors that do not require immediate action but should typically be logged and monitored.
- `critical` - Critical conditions.
- `alert` - Action must be taken immediately.
- `emergency` - System is unusable.

Basic usage
-----------

[](#basic-usage)

The primary entry point is the static `Log` class. Configure handlers near the start of the application, then call the matching log-level method whenever you need it.

Usage example
-------------

[](#usage-example)

```
use GT\Logger\Log;
use GT\Logger\LogConfig;
use GT\Logger\LogLevel;
use GT\Logger\LogHandler\StreamHandler;
use GT\Logger\LogHandler\FileHandler;
use GT\Logger\LogHandler\StdErrHandler;

// Send warnings and above to the remote socket.
LogConfig::addHandler(new StreamHandler("/example/remote.sock"), LogLevel::WARNING);
// Send all log types to the local log file.
LogConfig::addHandler(new FileHandler("/var/log/example.log"), LogLevel::DEBUG);
// Send only errors and above to STDERR.
LogConfig::addHandler(new StdErrHandler(), LogLevel::ERROR, LogLevel::EMERGENCY);
// Send lower-severity logs to STDOUT.
LogConfig::addHandler(LogConfig::getDefaultHandler(), LogLevel::DEBUG, LogLevel::WARNING);

$fileName = "name.txt";
if(file_exists($fileName)) {
        $name = trim(file_get_contents($fileName));

        if(empty($name)) {
                Log::error("Empty name loaded");
        }
        else {
                Log::info("Loaded name: $name");
        }
}
else {
        $name = "you";
        Log::info("Using default name");
}
```

The primary namespace is `GT\Logger`. The legacy `Gt\Logger` classes remain autoloadable for backwards compatibility.

Full documentation is available in the wiki: \[psr3\]: \[syslog\]:

Proudly sponsored by
====================

[](#proudly-sponsored-by)

[JetBrains Open Source sponsorship program](https://www.jetbrains.com/community/opensource/)

[![JetBrains logo.](https://camo.githubusercontent.com/b5639e7738c6dfae9fe3f3e20175570b7376ce2577a772e09c25c2d4f14bf86e/68747470733a2f2f7265736f75726365732e6a6574627261696e732e636f6d2f73746f726167652f70726f64756374732f636f6d70616e792f6272616e642f6c6f676f732f6a6574627261696e732e737667)](https://www.jetbrains.com/community/opensource/)

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance86

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~815 days

Total

3

Last Release

107d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.4

v1.0.1PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e42344b91ce4b91ab57875969f67a0a6a48de570a08bc65d673b06b72fd3a3f?d=identicon)[g105b](/maintainers/g105b)

---

Top Contributors

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

---

Tags

logloggerlogginglogsno-aisyslog

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phpgt-logger/health.svg)

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B10.9k](/packages/psr-log)[open-telemetry/api

API for OpenTelemetry PHP.

1938.5M261](/packages/open-telemetry-api)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2326.5M315](/packages/open-telemetry-sdk)[illuminated/console-logger

Logging and Notifications for Laravel Console Commands.

8676.7k](/packages/illuminated-console-logger)

PHPackages © 2026

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