Skip to content

Latest commit

 

History

History
51 lines (42 loc) · 855 Bytes

File metadata and controls

51 lines (42 loc) · 855 Bytes

Log level

Enum for severity level indicator in php according to RFC 5424

Installation

composer require kdabrow/log-level

Usage

Name Value
EMERGENCY 0
ALERT 1
CRITICAL 2
ERROR 3
WARNING 4
NOTICE 5
INFO 6
DEBUG 7

Methods

toLower

Prints lower case log name

<?php

use Kdabrow\LogLevel\Level;

echo Level::ERROR->toLower(); // prints: error

Examples

Compare by lower name

<?php

use Kdabrow\LogLevel\Level;

if (Level::INFO->toLower() == 'info') {
    echo "is info level log";
}

Compare by numeric value

<?php

use Kdabrow\LogLevel\Level;

if (Level::INFO == 6) {
    echo "is info level log";
}