diff --git "a/class-cli\\Log.php" "b/class-cli\\Log.php" index d6721b2..2e3d178 100644 --- "a/class-cli\\Log.php" +++ "b/class-cli\\Log.php" @@ -1,81 +1,93 @@ . # Command line interface namespace cli; /** * Show log messages */ class Log { /** - * Verbose information messages flag - * - * @var bool + * Verbose sensitive information messages flag */ - public static $DEBUG = false; + public static $SENSITIVE = false; /** - * Warnings flag + * Verbose information messages flag * * @var bool */ - public static $WARNING = true; + public static $DEBUG = false; /** * 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 ); + self::log( 'DEBUG', $message ); } /** * Show an error * * @param $message string */ public static function error( $message ) { self::log( 'ERROR', $message ); } + /** + * Show a debug information message that contains sensitive informations + * + * @param $message_sensitive Message with sensitive informations + * @param $message_unsensitive Message secure to be shown + */ + public static function sensitive( $message_sensitive, $message_unsensitive ) { + if( self::$SENSITIVE ) { + self::log( '!DEBUG!', $message_sensitive ); + } elseif( $message_unsensitive ) { + self::log( '!DEBUG!', "$message_unsensitive [SENSITIVE DATA HIDDEN]" ); + } + } + /** * Show a message * * @param $type string * @param $message string */ public static function log( $type, $message ) { printf( "# [%s] \t %s\n", $type, $message ); } }