PHPackages                             carlosafonso/logga - 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. carlosafonso/logga

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

carlosafonso/logga
==================

A logging library for PHP designed for simplicity and ease of use

3.0.0(11y ago)04.0k↓50%[2 issues](https://github.com/carlosafonso/logga/issues)MITPHPPHP &gt;= 5.3.0

Since Apr 13Pushed 11y ago1 watchersCompare

[ Source](https://github.com/carlosafonso/logga)[ Packagist](https://packagist.org/packages/carlosafonso/logga)[ Docs](http://github.com/carlosafonso/logga)[ RSS](/packages/carlosafonso-logga/feed)WikiDiscussions develop Synced 1mo ago

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

logga
=====

[](#logga)

[![Latest Stable Version](https://camo.githubusercontent.com/f26e454408daf27baf0c14b84e8db18e63a958bcbad5f192568aeeea987daacd/68747470733a2f2f706f7365722e707567782e6f72672f6361726c6f7361666f6e736f2f6c6f6767612f762f737461626c652e706e67)](https://packagist.org/packages/carlosafonso/logga)[![Build Status](https://camo.githubusercontent.com/853706f1cb451d251be470dd05b78daabb859b7bc71d59ed75c90ff1b8c642a0/68747470733a2f2f7472617669732d63692e6f72672f6361726c6f7361666f6e736f2f6c6f6767612e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/carlosafonso/logga)[![Total Downloads](https://camo.githubusercontent.com/f25f48ed510b8d79fc03d130546ca2a45c7e54a169ac50b8cd0d08e8ea8c9e44/68747470733a2f2f706f7365722e707567782e6f72672f6361726c6f7361666f6e736f2f6c6f6767612f646f776e6c6f6164732e706e67)](https://packagist.org/packages/carlosafonso/logga)[![License](https://camo.githubusercontent.com/87eb0eac03dcbe1f21580715c547b291fbfeeabf16135e2144523db47410bfd7/68747470733a2f2f706f7365722e707567782e6f72672f6361726c6f7361666f6e736f2f6c6f6767612f6c6963656e73652e706e67)](https://packagist.org/packages/carlosafonso/logga)

Logga is a logging library for PHP designed for simplicity and ease of use. Starting from v1.0.0, Logga features support for multiple logging streams and message formatters, providing developers with great flexibility.

Current version features a file stream and a default formatter. Future releases of Logga will have a Database stream out of the box, as well as a plugin system to allow developers to write custom streams and formatters so that pretty much every logging need is covered.

\##Installation ###Composer Since version 2.0.0 Logga can be installed using [Composer](https://getcomposer.org/). Add the following dependency to your `composer.json`:

```
{
  "require": {
    "carlosafonso/logga": "3.*",
  }
}
```

Then run:

```
$ composer update
```

Don't forget to include Composer's autoload file if you haven't done so already:

```
require 'vendor/autoload.php':
```

\###Manual installation Logga can also be installed by [downloading the latest version](https://github.com/carlosafonso/logga/archive/master.zip) and unzipping everything into your project folder, or by cloning the repository:

```
$ git clone https://github.com/carlosafonso/logga.git
```

Remember to include the main library file into your project:

```
require 'logga.php';
```

\##Quick start Set up a quick logger with the following code:

```
$l = new \Logga\Logga();
$l->info('Hello world!');
```

If you run this code, the following line will be printed on screen:

```
[2014-02-15 17:42:14][INFO   ]: Hello world!

```

Furthermore, a file named something like `default_log.log` will appear in the folder you're running your script from. A quick look into it reveals the same content shown above.

And that's pretty much it! You have set up your logging system with just a couple of lines. From now on you can trace everything you need using any of the eight logging functions provided by Logga (`debug()`, `info()`, `notice()`, `warning()`, `error()`, `critical()`, `alert()` and `emergency()`).

\##Usage The above is simple enough for the average developer but you might want to customize Logga a bit in order to fulfill your needs. This section will show you how.

\###Understanding streams In Logga, as in other logging libraries, a stream is an abstraction of a place where log messages are stored. You can use as many streams as you need, so that logging a message just once produces the same output in different places (i.e., a plain text file and a database table).

Additionally, you can configure each stream: for example, you might want all messages to be logged to the plain text file but only WARNING messages or above into the database.

As of version 2.2.0, Logga comes with 4 streams: `FileStream`, `HttpStream`, `MailStream` and `StandardOutputStream` (with several others currently in the works, such as `DatabaseStream`).

\###Default streams If you don't specifically provide any stream to Logga's constructor, the library will use both a `FileStream` and a `StandardOutputStream` by default (the first one logging to a file named `default_log.log`).

\###Creating a custom stream You can create a stream by instantiating any class which extends from `LogStream`, optionally passing an array with the desired options:

```
$s = new FileStream(array('file' => 'my_custom_log_file', 'date' => TRUE));
$l = new Logga($s);
$l->info('Hi, custom file!');
```

The above will produce a file called `my_custom_log_file_.log`, where `datetime` is the current date and time.

You can use more than one stream. Just call Logga's constructor with an array of streams:

```
$s1 = new FileStream(array('file' => 'my_first_custom_log_file', 'date' => TRUE));
$s2 = new FileStream(array('file' => 'my_second_custom_log_file', 'date' => TRUE));
$l = new Logga(array($s1, $s2));
$l->info('Hi, custom file!');
```

\##Streams ###Specifying a log level

\###Enabling and disabling streams

\###Available stream classes

\##Formatters

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

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

Total

4

Last Release

4195d ago

Major Versions

2.2.0 → 3.0.02014-11-23

### Community

Maintainers

![](https://www.gravatar.com/avatar/298322ba620ba6518bce36e896723f1f771c4ee6257ab49548c45dcb06e2b9ce?d=identicon)[carlosafonso](/maintainers/carlosafonso)

---

Top Contributors

[![carlosafonso](https://avatars.githubusercontent.com/u/1700229?v=4)](https://github.com/carlosafonso "carlosafonso (13 commits)")

---

Tags

logging

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/carlosafonso-logga/health.svg)

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

###  Alternatives

[monolog/monolog

Sends your logs to files, sockets, inboxes, databases and various web services

21.4k964.9M7.0k](/packages/monolog-monolog)[symfony/monolog-bundle

Symfony MonologBundle

2.9k249.1M1.6k](/packages/symfony-monolog-bundle)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[sentry/sentry

PHP SDK for Sentry (http://sentry.io)

1.9k227.1M273](/packages/sentry-sentry)[sentry/sentry-laravel

Laravel SDK for Sentry (https://sentry.io)

1.3k114.3M154](/packages/sentry-sentry-laravel)[sentry/sentry-symfony

Symfony integration for Sentry (http://getsentry.com)

73661.4M66](/packages/sentry-sentry-symfony)

PHPackages © 2026

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