PHPackages                             alen-dev/xpath-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. alen-dev/xpath-log

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

alen-dev/xpath-log
==================

Simple Laravel Logger

v1.0.0(11mo ago)02[3 PRs](https://github.com/alen-dev/xpath-log/pulls)MITPHPPHP ^8.2CI passing

Since Aug 4Pushed 2mo agoCompare

[ Source](https://github.com/alen-dev/xpath-log)[ Packagist](https://packagist.org/packages/alen-dev/xpath-log)[ Docs](https://github.com/alen-dev/xpath-log)[ GitHub Sponsors](https://github.com/alen-dev)[ RSS](/packages/alen-dev-xpath-log/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (9)Versions (7)Used By (0)

XpathLog 📓
==========

[](#xpathlog-)

[![Latest Version on Packagist](https://camo.githubusercontent.com/32055c51aedc08a1fcd5016e34c5085c8c921d431cc19cc84826ab3667286d85/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c656e2d6465762f78706174682d6c6f672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alen-dev/xpath-log)[![GitHub Tests Action Status](https://camo.githubusercontent.com/57f65483d2914ccef24089dff6ad3f34ef8077bac21fc3071097b2c1023d08d9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616c656e2d6465762f78706174682d6c6f672f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/alen-dev/xpath-log/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/f5066a24dd6661b37ddb730ab3e7e62b83cf4ba59e605379c91c4ba5dc848ff1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616c656e2d6465762f78706174682d6c6f672f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/alen-dev/xpath-log/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/a262ee0e342cf470cca0ac0c7619ffbcf78f5c34fe28bba7bb7923fb680c5384/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c656e2d6465762f78706174682d6c6f672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alen-dev/xpath-log)

A simple and extensible Laravel logging package for structured logging, transactions, and multiple output drivers — all with zero code changes when switching drivers.

---

🚀 Features
----------

[](#-features)

- 🔧 Multiple log levels (`debug`, `info`, `warning`, `error`)
- 🏷 Tagged log entries with custom attributes
- 📁 Supports multiple drivers:
    - CLI (console output)
    - JSON file logging (rotated daily)
    - Simple text log file
- 🔄 Transaction-based logging with start/end timestamps
- 📆 Log viewer Artisan command with filters
- ➕ Easily add custom drivers without modifying the core
- 📦 Laravel-ready with automatic service provider &amp; facade

---

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

[](#-installation)

```
composer require alen-dev/xpath-log
```

🛠 Setup
-------

[](#-setup)

Step 1: Publish the config

```
php artisan vendor:publish --tag=xpath-log-config
```

This is the contents of the published config file:

```
return [
    'driver_map' => [
        'cli' => \AlenDev\XpathLog\Drivers\CliDriver::class,
        'json' => \AlenDev\XpathLog\Drivers\JsonFileDriver::class,
        'log'  => \AlenDev\XpathLog\Drivers\LogFileDriver::class,
    ],
    'external_driver_map' => [],
    'default_drivers' => explode(',', env('XPATH_LOG_DEFAULT_DRIVERS', 'cli,log')),
    'file_name' => env('XPATH_LOG_FILENAME', 'xpath'),
];
```

Step 2: Optional ENV config

```
XPATH_LOG_DEFAULT_DRIVERS="cli,log"
XPATH_LOG_FILENAME=xpathlog
```

---

🧪 Usage
-------

[](#-usage)

Basic Logging

```
$xPathLog = new XpathLog();
$xPathLog
    ->use('cli')
    ->log('warning', 'message', ['test' => '34234']);
```

Transaction Logging

```
$xPathLog
    ->use('json')
    ->startTransaction('TX-789', ['customerId' => 123]);
$xPathLog
    ->use('json')
    ->endTransaction('TX-789', ['status' => 'success']);
```

Or log custom transaction messages:

```
$xPathLog
    ->use('json')
    ->transaction('abc-123', 'Applied discount', ['code' => 'SUMMER']);
```

---

🖥 Artisan Log Viewer
--------------------

[](#-artisan-log-viewer)

Optional: you can add some sample data for Artisan Log Viewer. The log viewer is designed to view JSON log created by this package.

```
php artisan xpathlog:create-sample
```

View the most recent XpathLog entries from your JSON log file (other file formats coming soon)

```
php artisan xpathlog:view
```

Filter logs

```
php artisan xpathlog:view --level=error
php artisan xpathlog:view --search=payment
php artisan xpathlog:view --date=2025-08-01
php artisan xpathlog:view --from="2025-08-01" --to="2025-08-02"
php artisan xpathlog:view --search=payment --from="yesterday"
```

🧩 Custom Drivers
----------------

[](#-custom-drivers)

You can register custom drivers externally via config:

```
// config/xpath-log.php
'driver_map' => [
    'slack' => App\Logging\Drivers\SlackDriver::class,
],
```

Each driver must implement:

```
interface DriverInterface {
    public function handle(LogEntry $entry): void;
}
```

🧩 Request Logger
----------------

[](#-request-logger)

This feature is disabled by default. To enable just add the following variable to your .env file:

```
XPATH_LOG_ENABLE_REQUEST_LOGGER=true
```

If enabled, by default, this will log every request on your web middleware but you can change this by adding the following line to your .env file:

```
XPATH_LOG_MIDDLEWARE_GROUP=api
```

🧪 Testing
---------

[](#-testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Alain Traxler](https://github.com/alen-dev)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance71

Regular maintenance activity

Popularity2

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.5% 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

Unknown

Total

1

Last Release

334d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/30658062?v=4)[Alain Traxler](/maintainers/alen-dev)[@alen-dev](https://github.com/alen-dev)

---

Top Contributors

[![alen-dev](https://avatars.githubusercontent.com/u/30658062?v=4)](https://github.com/alen-dev "alen-dev (19 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelalen-devxpath-log

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/alen-dev-xpath-log/health.svg)

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

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M164](/packages/spatie-laravel-health)[keepsuit/laravel-opentelemetry

OpenTelemetry integration for laravel

167558.4k1](/packages/keepsuit-laravel-opentelemetry)[nightowl/agent

NightOwl monitoring agent — collects telemetry from laravel/nightwatch and writes to PostgreSQL

771.7k](/packages/nightowl-agent)[tapp/filament-maillog

Filament plugin to view outgoing mail

3070.3k1](/packages/tapp-filament-maillog)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[slimani/filament-media-manager

A media manager plugin for Filament.

126.9k](/packages/slimani-filament-media-manager)

PHPackages © 2026

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