Methods |
public
static
|
clearProgress(): ConsoleInterface
Clear the message most recently printed with logProgress()
Clear the message most recently printed with logProgress()
|
#
|
public
static
|
count(ConsoleInterface::LEVEL_* $level): ConsoleInterface
Record a message with the given level without printing anything
Record a message with the given 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" or similar with level LEVEL_DEBUG (see {@see ConsoleInterface::debug()})
Print ": $msg1 $msg2" or similar with level 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" or similar with level LEVEL_DEBUG once per run (see {@see ConsoleInterface::debugOnce()})
Print ": $msg1 $msg2" or similar with level LEVEL_DEBUG once per run (see {@see ConsoleInterface::debugOnce()})
|
#
|
public
static
|
deregisterTarget(TargetInterface $target): ConsoleInterface
Deregister a target if it is currently registered with the console
Deregister a target if it is currently registered with the console
|
#
|
public
static
|
error(string $msg1, string|null $msg2 = null, Throwable|null $ex = null, bool $count = true): ConsoleInterface
Print "! $msg1 $msg2" or similar with level LEVEL_ERROR (see {@see ConsoleInterface::error()})
Print "! $msg1 $msg2" or similar with level LEVEL_ERROR (see {@see ConsoleInterface::error()})
|
#
|
public
static
|
errorOnce(string $msg1, string|null $msg2 = null, Throwable|null $ex = null, bool $count = true): ConsoleInterface
Print "! $msg1 $msg2" or similar with level LEVEL_ERROR once per run (see {@see ConsoleInterface::errorOnce()})
Print "! $msg1 $msg2" or similar with level LEVEL_ERROR once per run (see {@see ConsoleInterface::errorOnce()})
|
#
|
public
static
|
errors(): int
Get the number of error messages recorded so far
Get the number of error messages recorded so far
|
#
|
public
static
|
escape(string $string, bool $escapeNewlines = false): string
Escape inline formatting tags in a string so it can be safely used in a console message
Escape inline formatting tags in 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,
bool $count = true,
): ConsoleInterface
Print an exception and its stack trace with the given message levels (see {@see ConsoleInterface::exception()})
Print an exception and its stack trace with the given message levels (see {@see ConsoleInterface::exception()})
|
#
|
public
static
|
getStderrTarget(): StreamTargetInterface
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(): StreamTargetInterface
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<ConsoleInterface::TARGET_*> $targetFlags = 0,
): TargetInterface[]
Get registered targets, optionally filtering them by message level and flag
Get registered targets, optionally filtering them by message level and flag
|
#
|
public
static
|
getTtyTarget(): StreamTargetInterface
Get a TTY target, creating an unregistered one if necessary (see {@see ConsoleInterface::getTtyTarget()})
Get a TTY target, creating an unregistered one if necessary (see {@see ConsoleInterface::getTtyTarget()})
|
#
|
public
static
|
group(
string $msg1,
string|null $msg2 = null,
string|null $endMsg1 = null,
string|null $endMsg2 = null,
): ConsoleInterface
Increase message indentation level and print "» $msg1 $msg2" or similar with level LEVEL_NOTICE (see {@see…
Increase message indentation level and print "» $msg1 $msg2" or similar with level LEVEL_NOTICE (see {@see ConsoleInterface::group()})
|
#
|
public
static
|
groupEnd(): ConsoleInterface
Close the group of messages most recently opened with group()
Close the group of messages most recently opened with group()
|
#
|
public
static
|
info(string $msg1, string|null $msg2 = null): ConsoleInterface
Print "> $msg1 $msg2" or similar with level LEVEL_NOTICE (see {@see ConsoleInterface::info()})
Print "> $msg1 $msg2" or similar with level LEVEL_NOTICE (see {@see ConsoleInterface::info()})
|
#
|
public
static
|
infoOnce(string $msg1, string|null $msg2 = null): ConsoleInterface
Print "> $msg1 $msg2" or similar with level LEVEL_NOTICE once per run (see {@see ConsoleInterface::infoOnce()})
Print "> $msg1 $msg2" or similar with level LEVEL_NOTICE once per run (see {@see ConsoleInterface::infoOnce()})
|
#
|
public
static
|
log(string $msg1, string|null $msg2 = null): ConsoleInterface
Print "- $msg1 $msg2" or similar with level LEVEL_INFO (see {@see ConsoleInterface::log()})
Print "- $msg1 $msg2" or similar with level LEVEL_INFO (see {@see ConsoleInterface::log()})
|
#
|
public
static
|
logOnce(string $msg1, string|null $msg2 = null): ConsoleInterface
Print "- $msg1 $msg2" or similar with level LEVEL_INFO once per run (see {@see ConsoleInterface::logOnce()})
Print "- $msg1 $msg2" or similar with level LEVEL_INFO once per run (see {@see ConsoleInterface::logOnce()})
|
#
|
public
static
|
logProgress(string $msg1, string|null $msg2 = null): ConsoleInterface
Print "⠋ $msg1 $msg2" or similar with level LEVEL_INFO to TTY targets without moving to the next line (see {@see…
Print "⠋ $msg1 $msg2" or similar with level LEVEL_INFO to TTY targets without moving to the next line (see {@see ConsoleInterface::logProgress()})
|
#
|
public
static
|
logger(): LoggerInterface
Get a PSR-3 logger backed by the console
Get a PSR-3 logger backed by the console
|
#
|
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" or similar with level- and type-based formatting (see {@see ConsoleInterface::message()})
Print "$msg1 $msg2" or similar with level- and type-based formatting (see {@see ConsoleInterface::message()})
|
#
|
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" or similar with level- and type-based formatting once per run (see {@see ConsoleInterface:…
Print "$msg1 $msg2" or similar with level- and type-based formatting once per run (see {@see ConsoleInterface::messageOnce()})
|
#
|
public
static
|
print(string $msg, ConsoleInterface::LEVEL_* $level = ConsoleInterface::LEVEL_INFO): ConsoleInterface
Print "$msg" to registered targets (see {@see ConsoleInterface::print()})
Print "$msg" to registered targets (see {@see ConsoleInterface::print()})
|
#
|
public
static
|
printStdio(string $msg, ConsoleInterface::LEVEL_* $level = ConsoleInterface::LEVEL_INFO): ConsoleInterface
Print "$msg" to registered targets that write to STDOUT or STDERR (see {@see ConsoleInterface::printStdio()})
Print "$msg" to registered targets that write to STDOUT or STDERR (see {@see ConsoleInterface::printStdio()})
|
#
|
public
static
|
printStdout(string $msg, ConsoleInterface::LEVEL_* $level = ConsoleInterface::LEVEL_INFO): ConsoleInterface
Print "$msg" to STDOUT, creating an unregistered target if necessary (see {@see ConsoleInterface::printStdout()})
Print "$msg" to STDOUT, creating an unregistered target if necessary (see {@see ConsoleInterface::printStdout()})
|
#
|
public
static
|
printTty(string $msg, ConsoleInterface::LEVEL_* $level = ConsoleInterface::LEVEL_INFO): ConsoleInterface
Print "$msg" to registered targets that write to a TTY (see {@see ConsoleInterface::printTty()})
Print "$msg" to registered targets that write to a TTY (see {@see ConsoleInterface::printTty()})
|
#
|
public
static
|
registerStderrTarget(bool|null $debug = null): ConsoleInterface
Register STDERR for console output if running on the command line (see {@see ConsoleInterface::registerStderrTarget()})
Register STDERR for console output if running on the command line (see {@see ConsoleInterface::registerStderrTarget()})
|
#
|
public
static
|
registerStdioTargets(bool|null $debug = null): ConsoleInterface
Register STDOUT and STDERR for console output if running on the command line (see {@see ConsoleInterface:…
Register STDOUT and STDERR for console output if running on the command line (see {@see ConsoleInterface::registerStdioTargets()})
|
#
|
public
static
|
registerTarget(
TargetInterface $target,
array<ConsoleInterface::LEVEL_*> $levels = ConsoleInterface::LEVELS_ALL,
): ConsoleInterface
Register a target to receive output with each of the given message levels from the console
Register a target to receive output with each of the given message levels from the console
|
#
|
public
static
|
removeEscapes(string $string): string
Remove escapes from inline formatting tags in a string
Remove escapes from inline formatting tags in a string
|
#
|
public
static
|
removeTags(string $string): string
Remove inline formatting tags from a string
Remove inline formatting tags from a string
|
#
|
public
static
|
setPrefix(string|null $prefix, int-mask-of<ConsoleInterface::TARGET_*> $targetFlags = 0): ConsoleInterface
Set or unset the prefix applied to each line of output by registered targets that implement HasPrefix after optionally…
Set or unset the prefix applied to each line of output by registered targets that implement HasPrefix after optionally filtering them by flag
|
#
|
public
static
|
summary(
string $finishedText = "'Command finished'",
string $successText = "'without errors'",
bool $withResourceUsage = false,
bool $withoutErrorsAndWarnings = false,
bool $withGenericType = false,
): ConsoleInterface
Print a "command finished" message with a summary of errors, warnings and resource usage (see {@see ConsoleInterface:…
Print a "command finished" message with a summary of errors, warnings and resource usage (see {@see ConsoleInterface::summary()})
|
#
|
public
static
|
warn(string $msg1, string|null $msg2 = null, Throwable|null $ex = null, bool $count = true): ConsoleInterface
Print "^ $msg1 $msg2" or similar with level LEVEL_WARNING (see {@see ConsoleInterface::warn()})
Print "^ $msg1 $msg2" or similar with level LEVEL_WARNING (see {@see ConsoleInterface::warn()})
|
#
|
public
static
|
warnOnce(string $msg1, string|null $msg2 = null, Throwable|null $ex = null, bool $count = true): ConsoleInterface
Print "^ $msg1 $msg2" or similar with level LEVEL_WARNING once per run (see {@see ConsoleInterface::warnOnce()})
Print "^ $msg1 $msg2" or similar with level LEVEL_WARNING once per run (see {@see ConsoleInterface::warnOnce()})
|
#
|
public
static
|
warnings(): int
Get the number of warning messages recorded so far
Get the number of warning messages recorded so far
|
#
|