PHPackages                             pel/loggy - 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. pel/loggy

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

pel/loggy
=========

A simple PHP logging class.

05PHP

Since Sep 20Pushed 10y ago1 watchersCompare

[ Source](https://github.com/pelevesque/loggy)[ Packagist](https://packagist.org/packages/pel/loggy)[ RSS](/packages/pel-loggy/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

loggy
=====

[](#loggy)

About
-----

[](#about)

loggy is a simple PHP logging class.

It helps you log messages to a file.

Usage
-----

[](#usage)

### Initialization

[](#initialization)

First, create some blank files to store your logs. Make sure they are writable.

```
// Create a default version of loggy.
// default = $loggy->(TRUE, 20, 80, 'D F j, G:i:s T, Y', 'UTC);
$loggy = new loggy();

// Create a custom version of loggy.
$write_enabled = TRUE; // Enable writing to files.
$type_width = 30; // Width allocated to the message type.
$divider_width = 100; // Width allocated to the divider.
$date_format = 'D F j, G:i:s T'; // http://php.net/manual/en/function.date.php
$timezone_identifier = 'Asia/Toykyo'; // http://www.php.net/manual/en/timezones.php
$loggy = new loggy(
    $write_enabled,
    $type_width,
    $divider_width,
    $date_format,
    $timezone_identifier
);

// Options can also be set after initialization.
$loggy->write_enabled = FALSE;
$loggy->type_width = 35;
$loggy->divider_width = 50;
$loggy->date_format = 'D F j';
$loggy->timezone_identifier = 'UTC';
```

### Modifying The Logs

[](#modifying-the-logs)

```
// Add a message to the log.
$type = 'error';
$message = 'Parsing failed';
$loggy->add($type, $message);

// Clear the log.
$loggy->clear();

// Clear one type.
$loggy->clear('error');

// Clear many types.
$loggy->clear(array('error', 'feature', 'warning'));
```

### Returning Log Information

[](#returning-log-information)

```
// Get the log.
$log = $loggy->get();

// Get one logged type.
$log = $loggy->get('error');

// Get many logged types.
$log = $loggy->get(array('error', 'feature', 'warning'));

// Count all the logged items.
$num_logged_items = $loggy->count();

// Count only one type of logged items.
$num_errors = $log = $loggy->count('error');

// Get many types of logged items,
$num_items = $loggy->count(array('error', 'feature', 'warning'));
```

### Writing Log To File

[](#writing-log-to-file)

```
// Write the entire logs at the end of the desired file.
$filename = 'logs.txt';
$loggy->write($filename);

// Write one type at the end of the desired file.
$filename = 'logs.txt';
$type = 'error';
$loggy->write($filename, $type);

// Write many types at the end of the desired file.
$filename = 'logs.txt';
$types = array('error', 'feature', 'warning');
$loggy->write($filename, $types);
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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/6b9e172fd0a1a1ac2d6afeca238d54424ee66f0076f857450d10ca7424a7a907?d=identicon)[pelevesque](/maintainers/pelevesque)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/pel-loggy/health.svg)

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

###  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)
