MonoLogManager extends LoggerManager
A logger manager.
Table of Contents
Constants
- DEFAULT_EXTENSION = '.log'
- DEFAULT_NAME = 'log'
- DEFAULT_PATH = 'log'
- READ = 'r'
- WRITE = 'w'
Properties
- $bubbles : bool
- Indicates if the bubbling is active.
- $directory : string|mixed
- The log directory.
- $dirPermissions : int|float
- The directory permission.
- $extension : string|mixed
- The extension of the logs files.
- $filePermissions : int|float
- The file permission.
- $level : int|Level
- The default level of the logger.
- $maxFiles : int
- The maximum number of files stored in the log folder.
- $name : string|null
- The name of the logging channel, a simple descriptive name that is attached to all log records.
- $path : string
- The path of the log folder.
- $formatter : FormatterInterface|null
- The line formatter.
Methods
- __construct() : mixed
- Creates a new MonoLogManager instance.
- clear() : bool
- Clear the content of the specific file.
- countLines() : int
- Returns the number of lines in a file.
- createLog() : array<string|int, mixed>|null
- Create a basic log definition.
- createLogger() : LoggerInterface
- Creates and configures a logger instance.
- getDirectory() : string
- Returns the log directory.
- getExtension() : string
- Returns the extension of the log files.
- getFileName() : string
- Returns the log file name.
- getFilePath() : string
- Returns the full log path.
- getFormatter() : FormatterInterface
- Retrieves the formatter instance.
- getLoggerFiles() : array<string|int, mixed>|false
- getLogLines() : array<string|int, mixed>|null
- Returns the list of lines of a specific log file.
- setFormatter() : void
- Sets the formatter for log entries.
Constants
DEFAULT_EXTENSION
public
mixed
DEFAULT_EXTENSION
= '.log'
DEFAULT_NAME
public
mixed
DEFAULT_NAME
= 'log'
DEFAULT_PATH
public
mixed
DEFAULT_PATH
= 'log'
READ
public
mixed
READ
= 'r'
WRITE
public
mixed
WRITE
= 'w'
Properties
$bubbles
Indicates if the bubbling is active.
public
bool
$bubbles
= true
$directory
The log directory.
public
string|mixed
$directory
= \oihana\enums\Char::EMPTY
$dirPermissions
The directory permission.
public
int|float
$dirPermissions
= 0775
$extension
The extension of the logs files.
public
string|mixed
$extension
$filePermissions
The file permission.
public
int|float
$filePermissions
= 0664
$level
The default level of the logger.
public
int|Level
$level
$maxFiles
The maximum number of files stored in the log folder.
public
int
$maxFiles
= 0
$name
The name of the logging channel, a simple descriptive name that is attached to all log records.
public
string|null
$name
$path
The path of the log folder.
public
string
$path
$formatter
The line formatter.
protected
FormatterInterface|null
$formatter
= null
Methods
__construct()
Creates a new MonoLogManager instance.
public
__construct([string $directory = Char::EMPTY ][, array<string|int, mixed> $init = [] ][, string|null $name = null ]) : mixed
Parameters
- $directory : string = Char::EMPTY
- $init : array<string|int, mixed> = []
- $name : string|null = null
clear()
Clear the content of the specific file.
public
clear(string $file) : bool
Parameters
- $file : string
Return values
boolcountLines()
Returns the number of lines in a file.
public
countLines(string $file) : int
Parameters
- $file : string
-
return int
Return values
intcreateLog()
Create a basic log definition.
public
createLog(string $line) : array<string|int, mixed>|null
Parameters
- $line : string
Return values
array<string|int, mixed>|nullcreateLogger()
Creates and configures a logger instance.
public
createLogger() : LoggerInterface
This method sets up a logger with a rotating file handler, custom formatter, and registers it for error handling to capture system errors and exceptions.
Return values
LoggerInterface —The configured logger instance.
getDirectory()
Returns the log directory.
public
getDirectory() : string
Return values
stringgetExtension()
Returns the extension of the log files.
public
getExtension() : string
Return values
stringgetFileName()
Returns the log file name.
public
getFileName() : string
Return values
stringgetFilePath()
Returns the full log path.
public
getFilePath() : string
Return values
stringgetFormatter()
Retrieves the formatter instance.
public
getFormatter() : FormatterInterface
Return values
FormatterInterfacegetLoggerFiles()
public
getLoggerFiles() : array<string|int, mixed>|false
Return values
array<string|int, mixed>|falsegetLogLines()
Returns the list of lines of a specific log file.
public
getLogLines(string $file) : array<string|int, mixed>|null
Parameters
- $file : string
Return values
array<string|int, mixed>|nullsetFormatter()
Sets the formatter for log entries.
public
setFormatter() : void