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

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

maatify/logger
==============

maatify.dev logger, known by our team

6.0.1(8mo ago)054520proprietaryPHP

Since Jul 24Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/Maatify/Logger)[ Packagist](https://packagist.org/packages/maatify/logger)[ Docs](https://github.com/Maatify/)[ RSS](/packages/maatify-logger/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (13)Used By (20)

[![Current version](https://camo.githubusercontent.com/f3633ca4c8878ee4eb3ee43fddb5eb14daa8a65d441462b09e56b60cbe250e59/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6161746966792f6c6f67676572)](https://packagist.org/packages/maatify/logger)[![Packagist PHP Version Support](https://camo.githubusercontent.com/49e7f783a6b7097239724ba4f805ad57d589cc88d7fc93b433a70ad7d06e7bed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d6161746966792f6c6f67676572)](https://packagist.org/packages/maatify/logger)[![Monthly Downloads](https://camo.githubusercontent.com/4bef32d19a7c22163eec3e1024064810b7f3609ba63102db91a29670b1405ada/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6d6161746966792f6c6f67676572)](https://packagist.org/packages/maatify/logger/stats)[![Total Downloads](https://camo.githubusercontent.com/53c6f338c7b5a2720a3f4049a6642aa73b2a4ae4e3e13ef4ccd2e2b6b7a2a7b1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6161746966792f6c6f67676572)](https://packagist.org/packages/maatify/logger/stats)

📜 Maatify Logger
================

[](#-maatify-logger)

A lightweight PSR-3 compatible Logger with **Monolog integration** (if available) and **file fallback** (date/hour folders).
Supports **legacy logging**, **modern PSR-3 methods**, and a **facade service** for easy usage.

---

✨ Features
----------

[](#-features)

- ✅ **PSR-3 compliant** (`LoggerInterface`, `LogLevel`).
- ✅ **Monolog integration** (if installed) – automatic backend.
- ✅ **File fallback** if Monolog is not available (organized by `year/month/day/hour`).
- ✅ **Structured JSON logs** (server info + message + context).
- ✅ **Facade service** (`LoggerService`) with static methods for quick usage.
- ✅ **Exception logging** via `logException()`.
- ✅ **Legacy support** (`RecordLog`) for old codebases.

---

📦 Installation
--------------

[](#-installation)

```
composer require maatify/logger
```

If you also want Monolog support:

```
composer require monolog/monolog
```

---

🔧 Usage
-------

[](#-usage)

### 1. Using the Facade (`LoggerService`)

[](#1-using-the-facade-loggerservice)

```
use Maatify\Logger\LoggerService;

// Info log
LoggerService::info("User login successful", "auth/logs");

// Error log with Exception
try {
    throw new RuntimeException("DB connection failed");
} catch (Throwable $e) {
    LoggerService::logException($e, "system/errors");
}

// Debug log with context
LoggerService::debug("Payment request", "payments/debug", [
    'userId' => 123,
    'amount' => 99.99,
]);
```

---

### 2. Generic Logger Method

[](#2-generic-logger-method)

```
use Maatify\Logger\LoggerService;
use Psr\Log\LogLevel;

LoggerService::log(LogLevel::CRITICAL, "Out of memory!", "system/critical");
```

---

### 3. Exception Logging with Extra Context

[](#3-exception-logging-with-extra-context)

```
try {
    throw new RuntimeException("Unauthorized access");
} catch (Throwable $e) {
    LoggerService::logException(
        $e,
        "security/errors",
        LogLevel::CRITICAL,
        [
            'userId'    => 42,
            'requestId' => 'abc123',
            'ip'        => $_SERVER['REMOTE_ADDR'] ?? 'unknown',
        ]
    );
}
```

---

### 4. Legacy Support

[](#4-legacy-support)

For old codebases still using `RecordLog`:

```
use Maatify\Logger\Logger;

Logger::RecordLog("Old style log", Logger::LEVEL_INFO, "legacy/system");
```

---

📂 Log Storage Structure
-----------------------

[](#-log-storage-structure)

When using fallback file logging (without Monolog), logs are stored under:

```
logs/YYYY/MM/DD/HH/_YYYY-MM-DD-HH.log

```

Example:

```
logs/2025/09/04/16/system_errors_2025-09-04-16.log

```

Each log entry is JSON formatted:

```
{
    "level": "ERROR",
    "time": "2025-09-04 16:15:00",
    "server": {
        "REMOTE_ADDR": "127.0.0.1",
        "HTTP_HOST": "example.com",
        "REQUEST_URI": "/login",
        "USER_AGENT": "Mozilla/5.0"
    },
    "message": "Exception captured",
    "context": {
        "userId": 42,
        "exception": {
            "message": "Unauthorized access",
            "file": "/var/www/app/login.php",
            "line": 88,
            "code": 0,
            "trace": "stack trace..."
        }
    }
}
```

---

⚙️ Configuration
----------------

[](#️-configuration)

- Default log path: `./logs`
- Default file extension: `.log`
- Default fallback log level: `info`
- Uses Monolog automatically if installed.

---

🛡️ License
----------

[](#️-license)

This project is proprietary ©2025 [Maatify.dev](https://maatify.dev)

---

✍️ Author
---------

[](#️-author)

**Mohamed Abdulalim**[maatify.dev](https://maatify.dev) – [GitHub](https://github.com/Maatify)

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance61

Regular maintenance activity

Popularity17

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80.8% 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 ~39 days

Recently: every ~12 days

Total

12

Last Release

232d ago

Major Versions

1.3.0001 → 5.0.12025-08-10

5.0.1 → 6.0.12025-09-04

PHP version history (2 changes)1.1.003PHP &gt;=8.0.0

1.3.0001PHP &gt;=8.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1a885a0810f2762586520ab284c9019aaf0b650b53cdf2a6c13ea10931bb7795?d=identicon)[Maatify](/maintainers/Maatify)

---

Top Contributors

[![megyptm](https://avatars.githubusercontent.com/u/33574895?v=4)](https://github.com/megyptm "megyptm (21 commits)")[![Maatify](https://avatars.githubusercontent.com/u/130119162?v=4)](https://github.com/Maatify "Maatify (5 commits)")

---

Tags

phphandlerlogger

### Embed Badge

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

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

###  Alternatives

[logtail/monolog-logtail

Logtail handler for Monolog

233.2M3](/packages/logtail-monolog-logtail)[justbetter/magento2-sentry

Magento 2 Logger for Sentry

1851.5M3](/packages/justbetter-magento2-sentry)[opengento/module-webapi-logger

This module allows you to analyze all the webapi rest done call toward your Magento.

1014.9k](/packages/opengento-module-webapi-logger)

PHPackages © 2026

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