diff --git "a/class-cli\\Log.php" "b/class-cli\\Log.php" new file mode 100644 index 0000000..d6721b2 --- /dev/null +++ "b/class-cli\\Log.php" @@ -0,0 +1,81 @@ +. + +# Command line interface +namespace cli; + +/** + * Show log messages + */ +class Log { + + /** + * Verbose information messages flag + * + * @var bool + */ + public static $DEBUG = false; + + /** + * Warnings flag + * + * @var bool + */ + public static $WARNING = true; + + /** + * Show a warning + * + * Use it for errors that can be solved without interaction + * + * @param $message string + */ + public static function warn( $message ) { + self::log( 'WARN', $message ); + } + + /** + * Show a debug information + * + * Use it to show actions under the hood + * + * @param $message string + */ + public static function info( $message ) { + self::log( 'INFO', $message ); + } + + /** + * Show an error + * + * @param $message string + */ + public static function error( $message ) { + self::log( 'ERROR', $message ); + } + + /** + * Show a message + * + * @param $type string + * @param $message string + */ + public static function log( $type, $message ) { + printf( "# [%s] \t %s\n", $type, $message ); + } + +}