Neuron-PHP

RunLevel : int
in package

Logging run level enumeration for message prioritization and filtering.

This enum defines the standard logging levels used throughout the Neuron logging system for message classification, filtering, and prioritization. Each level has a numeric value that allows for easy comparison and hierarchical filtering, where higher values represent more critical messages.

Logging level hierarchy (lowest to highest priority):

  • DEBUG (0): Detailed diagnostic information for development and troubleshooting
  • INFO (10): General informational messages about application flow
  • NOTICE (15): Normal but significant events
  • WARNING (20): Warning messages about potentially harmful situations
  • ERROR (30): Error events that allow the application to continue running
  • CRITICAL (40): Critical conditions that need attention
  • ALERT (45): Action must be taken immediately
  • EMERGENCY (50): System is unusable

Key features:

  • Numeric values allow easy level comparison and filtering
  • String representation for human-readable output
  • Integration with log destinations and filters
  • Support for minimum level filtering
  • Consistent severity classification across all loggers
Tags
example
// Using run levels in logging
$logger = new Logger();
$logger->setMinimumLevel(RunLevel::WARNING);

// These will be logged (WARNING and above)
$logger->log(RunLevel::WARNING, 'Deprecated function used');
$logger->log(RunLevel::ERROR, 'Database connection failed');
$logger->log(RunLevel::CRITICAL, 'Critical system failure');

// These will be filtered out (below WARNING)
$logger->log(RunLevel::DEBUG, 'Variable value: ' . $var);
$logger->log(RunLevel::INFO, 'User logged in');

// Level comparison
if ($currentLevel->value >= RunLevel::ERROR->value) {
    $this->sendAlertEmail($message);
}

Table of Contents

Cases

ALERT  = 45
CRITICAL  = 40
DEBUG
EMERGENCY  = 50
ERROR  = 30
INFO  = 10
NOTICE  = 15
WARNING  = 20

Methods

getLevel()  : string

Cases

Methods

getLevel()

public getLevel() : string
Return values
string

        
On this page

Search results