PHPackages                             nanolog/nanolog - 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. nanolog/nanolog

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

nanolog/nanolog
===============

A simple and lightweight logging solution for PHP &gt;= 5.3

v0.0.5(13y ago)1981MITPHPPHP &gt;=5.3.0

Since Jan 4Pushed 13y ago1 watchersCompare

[ Source](https://github.com/rogeriopvl/php-nanolog)[ Packagist](https://packagist.org/packages/nanolog/nanolog)[ Docs](https://github.com/rogeriopvl/php-nanolog)[ RSS](/packages/nanolog-nanolog/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (7)Used By (0)

Nanolog
=======

[](#nanolog)

Small and simple logging solution for PHP &gt;= 5.3

Install
-------

[](#install)

```
composer install Nanolog\Nanolog

```

Usage
-----

[](#usage)

### One log instance in DEBUG mode (default)

[](#one-log-instance-in-debug-mode-default)

```
$log = \Nanolog\Nanolog::create('/tmp');

$log->critical('Cant connect to server');
$log->error('Cant open file');
$log->warning('Disk is 90% full');
$log->info('User foobar logged in');
$log->debug(print_r($obj, true));

$log = null;
$log = \Nanolog\Nanolog::getInstance();
$log->info('We have our log instance back again');

```

### Multiple log instances by name

[](#multiple-log-instances-by-name)

```
$log1 = \Nanolog\Nanolog::create('/tmp', \Nanolog\Nanolog::DEBUG, 'log_one');
$log2 = \Nanolog\Nanolog::create('/var/log', \Nanolog\Nanolog::DEBUG, 'log_two');

$log1->info('Our log_one instance was created');
$log2->info('Our log_two instance was created');

$log1 = null; // oops

$log1 = \Nanolog\Nanolog::getInstance('log_one');
$log1->info('We have our log_one back!');

```

Documentation
-------------

[](#documentation)

#### Public Attributes

[](#public-attributes)

- `const CRITITAL = 0`
- `const ERROR = 1`
- `const WARNING = 2`
- `const INFO = 3`
- `const DEBUG = 4`

#### Public static methods

[](#public-static-methods)

- `static getInstance ($name=null)`
- `static create ($folder, $level=self::DEBUG, $name=null, $fileName=null)`

#### Public instance methods

[](#public-instance-methods)

- `critical ($message)`
- `error ($message)`
- `warning ($message)`
- `info ($message)`
- `debug ($message)`
- `setLevel ($level)`
- `getName ()`

TODO
----

[](#todo)

- Log line prefix (including date format) customization

License
-------

[](#license)

The MIT License

Copyright (c) 2013 Rogério Vicente

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.2% 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 ~13 days

Total

5

Last Release

4829d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b930354019d2c1a2dc48d4372df29d3046e8d1f4d5d4771d2e5c8aff8d57c09?d=identicon)[rogeriopvl](/maintainers/rogeriopvl)

---

Top Contributors

[![rogeriopvl](https://avatars.githubusercontent.com/u/38240?v=4)](https://github.com/rogeriopvl "rogeriopvl (31 commits)")[![daniel-melzer](https://avatars.githubusercontent.com/u/389719?v=4)](https://github.com/daniel-melzer "daniel-melzer (3 commits)")

---

Tags

logloggingnanolog

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  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)[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)[rap2hpoutre/laravel-log-viewer

A Laravel log reader

3.2k14.7M71](/packages/rap2hpoutre-laravel-log-viewer)[sentry/sdk

This is a meta package of sentry/sentry. We recommend using sentry/sentry directly.

328134.8M151](/packages/sentry-sdk)

PHPackages © 2026

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