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

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

ialopezg/logger
===============

Logger Service for PHP

v0.0.4(5y ago)091MITPHPPHP ^5.6 || ^7.0

Since Sep 20Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ialopezg/logger)[ Packagist](https://packagist.org/packages/ialopezg/logger)[ RSS](/packages/ialopezg-logger/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (4)DependenciesVersions (5)Used By (1)

Logger Service
==============

[](#logger-service)

[![Total Downloads](https://camo.githubusercontent.com/842d7c12f34a8da857d1b58bbb291760b7b2c34e073be7bd24b106e57c1d4b8b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f69616c6f70657a672f6c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ialopezg/logger)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE.txt)

Logger Service for PHP. Easily and customizable logger service. Allow to you write log files, in custom paths or directories, file extension, date format, message indentation and several levels.

**Table of Contents**

- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#basic-usage)
    - [Options](#options)
    - [Methods details](#method-details)
- [License](#license)

Requirements
------------

[](#requirements)

- PHP 5.6+

Installation
------------

[](#installation)

Install latest version via composer:

```
composer require ialopezg/logger
```

Usage instructions
------------------

[](#usage-instructions)

### Basic usage

[](#basic-usage)

First, create a new "Logger" instance. Logger aims to make configuring the library as easy as possible.

```
$logger = new \ialopezg\Services\Logger([
    'log_path' => 'logs'
]);
```

For more options see [examples](examples) directory.

### Options

[](#options)

This is a list of possible options that can be passed when creating a logger instance:

- `enabled` if logger can write to the log files. Default: `true`.
- `log_date_format` log date format. Default: `Y-m-d H:i:s`.
- `log_file_extension` log file extension. Default: `log`.
- `log_path:` log path where log files will be written. If not specified or not writable, modify `Logger::enabled` property to `false`.
- `log_file_permissions` log files permissions. Default: `0644`, read and write for owner, read for everybody else.
- `log_indented` message indentation. Default: `true`.
- `log_threshold` log threshold. Default: `1` or `error`. Accepts single values or array of values. Accept single or array of values. Accepted values: `error`, `debug`, `info`, `warning`, `all`.

### Methods

[](#methods)

MethodDescription[`log()`](#logger_log)Static function that write a log message line into the default log system, new or empty log system.[`write()`](#logger_write)Write a log message line.#### Method Details

[](#method-details)

#####  Method: `log()`

[](#-method-log)

```
/**
 * Log a message into the default log system. If the log system does not exists, will create a new one.
 *
 * @param int $level log message level. Accepts: `debug`, `error`, `info` and `warning` messages.
 * @param string $message log message.
 *
 * @return bool true if line was successfully wrote, false otherwise.
 */
public static function log($level, $message): bool
```

**Examples**

```
// debug message
Logger::log('debug', 'Debug message');
// error message
Logger::log('error', 'Error message');
// info message
Logger::log('info', 'Informative message');
// warning message
Logger::log('warning', 'Waring message');
```

#####  Method: `write()`

[](#-method-write)

```
/**
 * Write a log message line.
 *
 * @param string $level Error log level.
 * @param string $message Error log message.
 *
 * @return bool True if line was successfully wrote.
 */
public static function write($level, $message): void
```

**Examples**

```
// debug message
$logger->write('debug', 'Debug message');
// error message
$logger->write('error', 'Error message');
// info message
$logger->write('info', 'Informative message');
// warning message
$logger->write('warning', 'Waring message');
```

License
-------

[](#license)

This project is under the MIT license. For more information see See [LICENSE](LICENSE).

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

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 ~0 days

Total

4

Last Release

2066d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7f97c20d9309952abd3cadf77f087307284d35ae6c484de3441eec36dbd5c93c?d=identicon)[ialopezg](/maintainers/ialopezg)

---

Tags

loglog-serviceloggerlogger-servicelogginglogging-librarylogging-service

### Embed Badge

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

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

###  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)[ekino/newrelic-bundle

Integrate New Relic into Symfony2

28111.2M8](/packages/ekino-newrelic-bundle)

PHPackages © 2026

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