Documentation

MainLogger extends AttachableThreadedLogger
in package
implements BufferedLogger

Interfaces, Classes, Traits and Enums

BufferedLogger

Table of Contents

$attachments  : Volatile|array<string|int, ThreadedLoggerAttachment>
$logDebug  : bool
$format  : string
$logWriterThread  : MainLoggerThread
$mainThreadName  : string
$timezone  : string
$useFormattingCodes  : bool
__construct()  : mixed
__destruct()  : mixed
addAttachment()  : void
alert()  : mixed
buffer()  : void
Buffers log messages while the closure is executed, and then flushes the buffer.
critical()  : mixed
debug()  : mixed
emergency()  : mixed
error()  : mixed
getAttachments()  : array<string|int, ThreadedLoggerAttachment>
getFormat()  : string
Returns the current logger format used for console output.
info()  : mixed
log()  : mixed
logException()  : void
notice()  : mixed
removeAttachment()  : void
removeAttachments()  : void
setFormat()  : void
Sets the logger format to use for outputting text to the console.
setLogDebug()  : void
shutdownLogWriterThread()  : void
syncFlushBuffer()  : void
warning()  : mixed
send()  : void

Properties

$format

private string $format = \pocketmine\utils\TextFormat::AQUA . "[%s] " . \pocketmine\utils\TextFormat::RESET . "%s[%s/%s]: %s" . \pocketmine\utils\TextFormat::RESET

$useFormattingCodes

private bool $useFormattingCodes = false

Methods

__construct()

public __construct(string $logFile, bool $useFormattingCodes, string $mainThreadName, DateTimeZone $timezone[, bool $logDebug = false ]) : mixed
Parameters
$logFile : string
$useFormattingCodes : bool
$mainThreadName : string
$timezone : DateTimeZone
$logDebug : bool = false
Tags
throws
RuntimeException
Return values
mixed

__destruct()

public __destruct() : mixed
Return values
mixed

alert()

public alert(mixed $message) : mixed
Parameters
$message : mixed
Return values
mixed

buffer()

Buffers log messages while the closure is executed, and then flushes the buffer.

public buffer(Closure $c) : void
Parameters
$c : Closure
Tags
phpstan-param

\Closure() : void $c

Return values
void

critical()

public critical(mixed $message) : mixed
Parameters
$message : mixed
Return values
mixed

debug()

public debug(mixed $message[, bool $force = false ]) : mixed
Parameters
$message : mixed
$force : bool = false
Return values
mixed

emergency()

public emergency(mixed $message) : mixed
Parameters
$message : mixed
Return values
mixed

error()

public error(mixed $message) : mixed
Parameters
$message : mixed
Return values
mixed

getFormat()

Returns the current logger format used for console output.

public getFormat() : string
Return values
string

info()

public info(mixed $message) : mixed
Parameters
$message : mixed
Return values
mixed

log()

public log(mixed $level, mixed $message) : mixed
Parameters
$level : mixed
$message : mixed
Return values
mixed

logException()

public logException(Throwable $e[, array<string|int, array<string|int, mixed>>|null $trace = null ]) : void
Parameters
$e : Throwable
$trace : array<string|int, array<string|int, mixed>>|null = null
Tags
phpstan-param

list<array<string, mixed>>|null $trace

Return values
void

notice()

public notice(mixed $message) : mixed
Parameters
$message : mixed
Return values
mixed

setFormat()

Sets the logger format to use for outputting text to the console.

public setFormat(string $format) : void

It should be an sprintf()able string accepting 5 string arguments:

  • time
  • color
  • thread name
  • prefix (debug, info etc)
  • message
Parameters
$format : string
Tags
see
http://php.net/manual/en/function.sprintf.php
Return values
void

setLogDebug()

public setLogDebug(bool $logDebug) : void
Parameters
$logDebug : bool
Return values
void

shutdownLogWriterThread()

public shutdownLogWriterThread() : void
Return values
void

syncFlushBuffer()

public syncFlushBuffer() : void
Return values
void

warning()

public warning(mixed $message) : mixed
Parameters
$message : mixed
Return values
mixed

send()

protected send(string $message, string $level, string $prefix, string $color) : void
Parameters
$message : string
$level : string
$prefix : string
$color : string
Return values
void

Search results