Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kikimarik/lognote

Standard PHP library for logging
https://github.com/kikimarik/lognote

log php

Last synced: 10 days ago
JSON representation

Standard PHP library for logging

Awesome Lists containing this project

README

        

# Lognote - standard PHP library for logging
## Features
***
- Object-oriented design (without static methods etc.)
- Compatible with PHP 7.1 and later, including PHP 8.1
- Support for the `json` format
- Ability to write log into the file or print to console output

## Why do you need it
***
The library helps PHP developers to log their application events at different levels. 6 levels have been implemented: errors, warnings, info, fatal, notice and debug.

`Lognote` has a nice object-oriented design and it is going to please you with its simplicity. Before testing a class that depends on that library component, it is easy to replace that dependency with a fake class.

## A Simple Example
***

```php
receiveInfo(new MessageLogLine("Start script info"));
$log->receiveWarning(new MessageLogLine("I`m the warning example"));
$log->receiveInfo(new MessageLogLine("End script info"));
/**
* It will create file example.log in current dir with content like:
{"date":"2022-06-15 19:25:10","level":"info","message":"Start script info"}
{"date":"2022-06-15 19:25:10","level":"warning","message":"I`m the warning example"}
{"date":"2022-06-15 19:25:10","level":"info","message":"End script info"}
*/
```

## License
***
This software is distributed under the MIT license.

## Installation
***
- via composer `composer require kikimarik/lognote`

## Tests
***
[Lognote tests](https://github.com/kikimarik/lognote/tree/master/tests) use the [Codeception 4.2.0](https://github.com/Codeception/Codeception/tree/4.2.0) framework.
All unit tests must be passed.

For tests running you can run the command:
`./vendor/bin/codecept run`