Contra › class › Console
From Botdom Documentation
Contra uses the Console class to format the console output. It really helps (slightly).
Contents |
Location
~/core/Console_class.php
Properties
public $format = 'H:i:s'; // Timestamp format used.
Methods
The methods here are simple yet effective.
Time
Return the current time!
Parameters: $timestamp - integer. The current timestamp. Automatically generates one if none is provided.
Example:
echo $Console->Time(),chr(10);
Clock
Returns the current time, encased in square brackets!
Parameters: $timestamp - integer. The current timestamp. Automatically generates one if none is provided.
Example:
echo $Console->Clock(),chr(10);
Message
Outputs a message to the console with a clock infront of it.
Parameters: $message - string. Message to be displayed. $timestamp - integer. The current timestamp. Automatically generates one if none is provided.
Example:
$Console->Message('Hello, world!'); // Output: [20:39:46] Hello, world!
Notice
Outputs a message, with extra formatting.
Parameters: $notice - string. Notice to be displayed. $timestamp - integer. The current timestamp. Automatically generates one if none is provided.
Example:
$Console->Notice('Hello, world!'); // Output: [20:39:46] ** Hello, world!
Warning
Outputs a message, with extra formatting.
Parameters: $warning - string. Warning to be displayed. $timestamp - integer. The current timestamp. Automatically generates one if none is provided.
Example:
$Console->Warning('Hello, world!'); // Output: [20:39:46] >> Hello, world!
Write
Outputs raw data.
Parameters: $data - mixed. Data to be displayed.
Example:
$Console->Write(array('Hello, world!')); /* Ouput: >>array ( >> 0 => 'Hello, world!', >>) */
log
Saves data to a log file.
Parameters: $string - string. Data to be saved.
Example:
$Console->log('Hello, world!');

