https://github.com/phore/phore-log
Logging functions
https://github.com/phore/phore-log
Last synced: 5 months ago
JSON representation
Logging functions
- Host: GitHub
- URL: https://github.com/phore/phore-log
- Owner: phore
- Created: 2018-08-07T06:20:38.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-12-12T09:38:38.000Z (over 1 year ago)
- Last Synced: 2025-10-06T20:59:51.565Z (8 months ago)
- Language: PHP
- Homepage: https://infracamp.org/project/phore/
- Size: 59.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Phore log :: PSR-3 compatible logger
[](https://github.com/phore/phore-log/actions)
- PSR-3 compliant logger
- Multiple targets (syslog, file, pipe) with individual configuration
- Quick configuration with single uri
- Multi-format support
## Installation
```bash
composer require phore/log
```
## Logger Usage
**Easy usage**
```php
phore_Log("Some log message"); // Debug message
phore_log("Value :val expected", ["val"=>"some unescaped value"]); // Auto escaping
phore_log()->emergency("Emergency Message");
```
## Configuration
**Global configuration**
```php
PhoreLogger::Register(PhoreLoggerFactory::BuildFromUri("syslog+udp://metrics.host.tld:4200?tag=server1"));
```
**Multi instance**
```
$logger = PhoreLoggerFactory::BuildFromUri();
```
### Logging
```
phore_log("something to log :message", ["message"=>"Hello"]);
phore_log()->setLogLevel(LogLevel::DEBUG);
phore_log()->emergency("emergency");
```
### LogLevel
| LogLevel | Code |
|-----------------------|------|
| LogLevel::EMERGENCY | 0 |
| LogLevel::ALERT | 1 |
| LogLevel::CRITICAL | 2 |
| LogLevel::ERROR | 3 |
| LogLevel::WARNING | 4 |
| LogLevel::NOTICE | 5 |
| LogLevel::INFO | 6 |
| LogLevel::DEBUG | 7 (default) |
### Logging configuration
You can specify one or more logger with different log levels.
```
syslog+udp://:/?severity=4&
syslogng+udp://
def://stdout?severity=4
def://stderr?severity=4
file:///var/log/xy.log?severity=4
```