| 1 | package Enum::Declare::Common::LogLevel; | ||
| 2 | |||
| 3 | 2 | ▶ | use 5.014; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 2 | ▶ | use Enum::Declare; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | enum Level :Type :Export { | ||
| 10 | Trace = 0, | ||
| 11 | Debug = 1, | ||
| 12 | Info = 2, | ||
| 13 | Warn = 3, | ||
| 14 | Error = 4, | ||
| 15 | Fatal = 5 | ||
| 16 | 2 | }; | |
| 17 | |||
| 18 | 2 | 1; | |
| 19 | |||
| 20 | =head1 NAME | ||
| 21 | |||
| 22 | Enum::Declare::Common::LogLevel - Numeric log levels for comparison | ||
| 23 | |||
| 24 | =head1 SYNOPSIS | ||
| 25 | |||
| 26 | use Enum::Declare::Common::LogLevel; | ||
| 27 | |||
| 28 | say Trace; # 0 | ||
| 29 | say Fatal; # 5 | ||
| 30 | |||
| 31 | # Filter by level | ||
| 32 | log($msg) if $level >= Warn; | ||
| 33 | |||
| 34 | =head1 ENUMS | ||
| 35 | |||
| 36 | =head2 Level :Export | ||
| 37 | |||
| 38 | Trace=0, Debug=1, Info=2, Warn=3, Error=4, Fatal=5. | ||
| 39 | Integer values support numeric comparison. | ||
| 40 | |||
| 41 | =head1 AUTHOR | ||
| 42 | |||
| 43 | LNATION C<< <email@lnation.org> >> | ||
| 44 | |||
| 45 | =head1 LICENSE AND COPYRIGHT | ||
| 46 | |||
| 47 | Copyright 2026 LNATION. Artistic License 2.0. | ||
| 48 | |||
| 49 | =cut | ||