[[SysOut]]
 

SysOut

Handles output to the console and log file.

Constant Summary

OUTLVL_NONE Disabled output level.
OUTLVL_FATAL Fatal error output level.
OUTLVL_ERROR General error output level.
OUTLVL_WARN Warning output level.
OUTLVL_NOTICE Notice output level.
OUTLVL_GENERAL General output level.
OUTLVL_ALL Full output level.

Method Summary

static setOutLvl Sets the console or file output level.
static enableDebug Enables or disables debug output.
static printMsg Prints a message to the console and log file if the respective output levels are high enough.
static printlnMsg Prints a message with a following line break to the console and log file if the respective output levels are high enough.
static printfMsg Prints a message, which is formatted in the style of printf and sprintf, to the console and log file if the respective output levels are high enough.
static printlnDebug Prints a debugging message to the console and log file if debug printing is enabled.

Constant Detail

OUTLVL_NONE

Disabled output level.

In the context of configuration, this disables all output.


OUTLVL_FATAL

Fatal error output level.

In the context of configuration, this enables only fatal error output. In the context of output printing, this specifies a fatal error. This alerts the user to fatal errors and automatically terminates the application.


OUTLVL_ERROR

General error output level.

In the context of configuration, this enables fatal error and general error output. In the context of output printing, this specifies a general error. This alerts the user to non-fatal errors.


OUTLVL_WARN

Warning output level.

In the context of configuration, this enables fatal error, general error, and warning output. In the context of output printing, this specifies a warning. This could warn the user of a potential error.


OUTLVL_NOTICE

Notice output level.

In the context of configuration, this enables fatal error, general error, warning, and notice output. In the context of output printing, this specifies a notice. This could notify the user of possible unexpected behavior.


OUTLVL_GENERAL

General output level.

In the context of configuration, this enables fatal error, general error, warning, notice, and general output. In the context of output printing, this specifies a general message. This is used to describe basic actions the application takes.


OUTLVL_ALL

Full output level.

In the context of configuration, this enables all output.

Method Detail

static setOutLvl

public static boolean setOutLvl ( string $type , int $lvl )

Sets the console or file output level.

Parameters:
$type - The output level type, either “console” or “file”.
$lvl - The output level to set. Use the SysOut::OUTLVL_* constants.

Return Values:
none


static enableDebug

public static void enableDebug ( [ bool $enable ] )

Enables or disables debug output.

Parameters:
$enable - Whether to enable debug output - DEFAULT: true

Return Values:
None


static printMsg

public static void SysOut::printMsg ( string $msg [ , int $consoleOutLvl [ , int $fileOutLvl ] ] )

Prints a message to the console and log file if the respective output levels are high enough. Note that $fileOutLvl will be set to the value of $consoleOutLvl if left unspecified.

Parameters:
$msg - The message to print.
$consoleOutLvl - Output level for the console. - DEFAULT: SysOut::OUTLVL_GENERAL
$fileOutLvl - Output level for the log file. - DEFAULT: $consoleOutLvl

Return Values:
None


static printlnMsg

public static void SysOut::printlnMsg ( string $msg [ , int $consoleOutLvl [ , int $fileOutLvl ] ] )

Prints a message with a following line break to the console and log file if the respective output levels are high enough. Note that $fileOutLvl will be set to the value of $consoleOutLvl if left unspecified.

Parameters:
$msg - The message to print.
$consoleOutLvl - Output level for the console. - DEFAULT: SysOut::OUTLVL_GENERAL
$fileOutLvl - Output level for the log file. - DEFAULT: $consoleOutLvl

Return Values:
None


static printfMsg

public static void SysOut::printfMsg ( string $format , array<mixed> $args [ , int $consoleOutLvl [ , int $fileOutLvl ] ] )

Prints a message, which is formatted in the style of printf and sprintf, to the console and log file if the respective output levels are high enough. Note that $fileOutLvl will be set to the value of $consoleOutLvl if left unspecified.

Parameters:
$format - The format string to parse and print.
$args - An array of arguments to insert into $format.
$consoleOutLvl - Output level for the console. - DEFAULT: SysOut::OUTLVL_GENERAL
$fileOutLvl - Output level for the log file. - DEFAULT: $consoleOutLvl

Return Values:
None


static printlnDebug

public static void printlnDebug ( string $msg )

Prints a debugging message to the console and log file if debug printing is enabled.

Parameters:
$msg - The message to print.

Return Values:
None

See Also

 
api/sysout.txt · Last modified: 2009/09/15 22:15 by pehjota
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki