Methods |
public
static
|
clearProgress(): ConsoleInterface
Print a "clear to end of line" control sequence with level INFO to TTY targets with a logProgress() message
Print a "clear to end of line" control sequence with level INFO to TTY targets with a logProgress() message
|
#
|
public
static
|
count(ConsoleInterface::LEVEL_* $level): ConsoleInterface
Record a message with level $level without printing anything
Record a message with level $level without printing anything
|
#
|
public
static
|
debug(string $msg1, string|null $msg2 = null, Throwable|null $ex = null, int $depth = 0): ConsoleInterface
Print ": <caller> $msg1 $msg2" with level DEBUG (see {@see ConsoleInterface::debug()})
Print ": $msg1 $msg2" with level DEBUG (see {@see ConsoleInterface::debug()})
|
#
|
public
static
|
debugOnce(string $msg1, string|null $msg2 = null, Throwable|null $ex = null, int $depth = 0): ConsoleInterface
Print ": <caller> $msg1 $msg2" with level DEBUG once per run (see {@see ConsoleInterface::debugOnce()})
Print ": $msg1 $msg2" with level DEBUG once per run (see {@see ConsoleInterface::debugOnce()})
|
#
|
public
static
|
deregisterTarget(ConsoleTargetInterface $target): ConsoleInterface
Deregister and close a registered target (see {@see ConsoleInterface::deregisterTarget()})
Deregister and close a registered target (see {@see ConsoleInterface::deregisterTarget()})
|
#
|
public
static
|
error(string $msg1, string|null $msg2 = null, Throwable|null $ex = null, bool $count = true): ConsoleInterface
Print "! $msg1 $msg2" with level ERROR
Print "! $msg1 $msg2" with level ERROR
|
#
|
public
static
|
errorOnce(string $msg1, string|null $msg2 = null, Throwable|null $ex = null, bool $count = true): ConsoleInterface
Print "! $msg1 $msg2" with level ERROR once per run
Print "! $msg1 $msg2" with level ERROR once per run
|
#
|
public
static
|
escape(string $string): string
Escape a string so it can be safely used in a console message
Escape a string so it can be safely used in a console message
|
#
|
public
static
|
exception(
Throwable $exception,
ConsoleInterface::LEVEL_* $level = ConsoleInterface::LEVEL_ERROR,
ConsoleInterface::LEVEL_*|null $traceLevel = ConsoleInterface::LEVEL_DEBUG,
): ConsoleInterface
Print an exception's name and message with a given level, optionally followed by its stack trace with a different level…
Print an exception's name and message with a given level, optionally followed by its stack trace with a different level (see {@see ConsoleInterface::exception()})
|
#
|
public
static
|
getErrorCount(): int
Get the number of error messages recorded so far
Get the number of error messages recorded so far
|
#
|
public
static
|
getFormatter(ConsoleInterface::LEVEL_* $level = ConsoleInterface::LEVEL_INFO): ConsoleFormatterInterface
Get an output formatter for a registered target (see {@see ConsoleInterface::getFormatter()})
Get an output formatter for a registered target (see {@see ConsoleInterface::getFormatter()})
|
#
|
public
static
|
getLogger(): LoggerInterface
Get a PSR-3 logger
|
#
|
public
static
|
getStderrTarget(): ConsoleTargetStreamInterface
Get a target for STDERR, creating an unregistered one if necessary
Get a target for STDERR, creating an unregistered one if necessary
|
#
|
public
static
|
getStdoutTarget(): ConsoleTargetStreamInterface
Get a target for STDOUT, creating an unregistered one if necessary
Get a target for STDOUT, creating an unregistered one if necessary
|
#
|
public
static
|
getTargets(
ConsoleInterface::LEVEL_*|null $level = null,
int-mask-of<ConsoleTargetTypeFlag::*> $flags = 0,
): ConsoleTargetInterface[]
Get a list of registered targets, optionally filtered by level and type
Get a list of registered targets, optionally filtered by level and type
|
#
|
public
static
|
getWarningCount(): int
Get the number of warning messages recorded so far
Get the number of warning messages recorded so far
|
#
|
public
static
|
getWidth(ConsoleInterface::LEVEL_* $level = ConsoleInterface::LEVEL_INFO): int|null
Get the width of a registered target in columns (see {@see ConsoleInterface::getWidth()})
Get the width of a registered target in columns (see {@see ConsoleInterface::getWidth()})
|
#
|
public
static
|
group(
string $msg1,
string|null $msg2 = null,
string|null $endMsg1 = null,
string|null $endMsg2 = null,
): ConsoleInterface
Increase the indentation level of messages and print "» $msg1 $msg2" with level NOTICE (see {@see ConsoleInterface:…
Increase the indentation level of messages and print "» $msg1 $msg2" with level NOTICE (see {@see ConsoleInterface::group()})
|
#
|
public
static
|
groupEnd(): ConsoleInterface
Close the nested message group most recently opened with group()
Close the nested message group most recently opened with group()
|
#
|
public
static
|
info(string $msg1, string|null $msg2 = null): ConsoleInterface
Print "➤ $msg1 $msg2" with level NOTICE
Print "➤ $msg1 $msg2" with level NOTICE
|
#
|
public
static
|
infoOnce(string $msg1, string|null $msg2 = null): ConsoleInterface
Print "➤ $msg1 $msg2" with level NOTICE once per run
Print "➤ $msg1 $msg2" with level NOTICE once per run
|
#
|
public
static
|
log(string $msg1, string|null $msg2 = null): ConsoleInterface
Print "- $msg1 $msg2" with level INFO
Print "- $msg1 $msg2" with level INFO
|
#
|
public
static
|
logOnce(string $msg1, string|null $msg2 = null): ConsoleInterface
Print "- $msg1 $msg2" with level INFO once per run
Print "- $msg1 $msg2" with level INFO once per run
|
#
|
public
static
|
logProgress(string $msg1, string|null $msg2 = null): ConsoleInterface
Print "⠿ $msg1 $msg2" with level INFO to TTY targets without moving to the next line (see {@see ConsoleInterface:…
Print "⠿ $msg1 $msg2" with level INFO to TTY targets without moving to the next line (see {@see ConsoleInterface::logProgress()})
|
#
|
public
static
|
message(
string $msg1,
string|null $msg2 = null,
ConsoleInterface::LEVEL_* $level = ConsoleInterface::LEVEL_INFO,
ConsoleInterface::TYPE_* $type = ConsoleInterface::TYPE_UNDECORATED,
Throwable|null $ex = null,
bool $count = true,
): ConsoleInterface
Print "$msg1 $msg2" with prefix and formatting optionally based on $level
Print "$msg1 $msg2" with prefix and formatting optionally based on $level
|
#
|
public
static
|
messageOnce(
string $msg1,
string|null $msg2 = null,
ConsoleInterface::LEVEL_* $level = ConsoleInterface::LEVEL_INFO,
ConsoleInterface::TYPE_* $type = ConsoleInterface::TYPE_UNDECORATED,
Throwable|null $ex = null,
bool $count = true,
): ConsoleInterface
Print "$msg1 $msg2" with prefix and formatting optionally based on $level once per run
Print "$msg1 $msg2" with prefix and formatting optionally based on $level once per run
|
#
|
public
static
|
print(
string $msg,
ConsoleInterface::LEVEL_* $level = ConsoleInterface::LEVEL_INFO,
ConsoleInterface::TYPE_* $type = ConsoleInterface::TYPE_UNFORMATTED,
): ConsoleInterface
Print "$msg" to registered targets
Print "$msg" to registered targets
|
#
|
public
static
|
printOut(
string $msg,
ConsoleInterface::LEVEL_* $level = ConsoleInterface::LEVEL_INFO,
ConsoleInterface::TYPE_* $type = ConsoleInterface::TYPE_UNFORMATTED,
): ConsoleInterface
Print "$msg" to registered STDOUT or STDERR targets
Print "$msg" to registered STDOUT or STDERR targets
|
#
|
public
static
|
printStderr(
string $msg,
ConsoleInterface::LEVEL_* $level = ConsoleInterface::LEVEL_INFO,
ConsoleInterface::TYPE_* $type = ConsoleInterface::TYPE_UNFORMATTED,
): ConsoleInterface
Print "$msg" to STDERR even if no STDERR target is registered
Print "$msg" to STDERR even if no STDERR target is registered
|
#
|
public
static
|
printStdout(
string $msg,
ConsoleInterface::LEVEL_* $level = ConsoleInterface::LEVEL_INFO,
ConsoleInterface::TYPE_* $type = ConsoleInterface::TYPE_UNFORMATTED,
): ConsoleInterface
Print "$msg" to STDOUT even if no STDOUT target is registered
Print "$msg" to STDOUT even if no STDOUT target is registered
|
#
|
public
static
|
printTty(
string $msg,
ConsoleInterface::LEVEL_* $level = ConsoleInterface::LEVEL_INFO,
ConsoleInterface::TYPE_* $type = ConsoleInterface::TYPE_UNFORMATTED,
): ConsoleInterface
Print "$msg" to registered TTY targets
Print "$msg" to registered TTY targets
|
#
|
public
static
|
registerStderrTarget(): ConsoleInterface
Register STDERR to receive console output if running on the command line (see {@see ConsoleInterface:…
Register STDERR to receive console output if running on the command line (see {@see ConsoleInterface::registerStderrTarget()})
|
#
|
public
static
|
registerStdioTargets(): ConsoleInterface
Register STDOUT and STDERR to receive console output if running on the command line (see {@see ConsoleInterface:…
Register STDOUT and STDERR to receive console output if running on the command line (see {@see ConsoleInterface::registerStdioTargets()})
|
#
|
public
static
|
registerTarget(
ConsoleTargetInterface $target,
array<ConsoleInterface::LEVEL_*> $levels = ConsoleInterface::LEVELS_ALL,
): ConsoleInterface
Register a target to receive console output
Register a target to receive console output
|
#
|
public
static
|
setTargetPrefix(string|null $prefix, int-mask-of<ConsoleTargetTypeFlag::*> $flags = 0): ConsoleInterface
Set or unset the prefix applied to each line of output by any registered targets that implement…
Set or unset the prefix applied to each line of output by any registered targets that implement ConsoleTargetPrefixInterface
|
#
|
public
static
|
summary(
string $finishedText = "'Command finished'",
string $successText = "'without errors'",
bool $withResourceUsage = false,
bool $withoutErrorCount = false,
bool $withStandardMessageType = false,
): ConsoleInterface
Print a "command finished" message with a summary of errors, warnings and resource usage
Print a "command finished" message with a summary of errors, warnings and resource usage
|
#
|
public
static
|
warn(string $msg1, string|null $msg2 = null, Throwable|null $ex = null, bool $count = true): ConsoleInterface
Print "^ $msg1 $msg2" with level WARNING
Print "^ $msg1 $msg2" with level WARNING
|
#
|
public
static
|
warnOnce(string $msg1, string|null $msg2 = null, Throwable|null $ex = null, bool $count = true): ConsoleInterface
Print "^ $msg1 $msg2" with level WARNING once per run
Print "^ $msg1 $msg2" with level WARNING once per run
|
#
|