mirror of
https://github.com/andres-montanez/Magallanes
synced 2024-06-13 11:12:16 +02:00
Merge pull request #153 from edpauto/verbose-option
Add verbose option to commands
This commit is contained in:
commit
d9e860a20c
|
@ -48,6 +48,12 @@ class Console
|
|||
*/
|
||||
private static $logEnabled = true;
|
||||
|
||||
/**
|
||||
* Enables or disables verbose logging
|
||||
* @var boolean
|
||||
*/
|
||||
private static $verboseLogEnabled = false;
|
||||
|
||||
/**
|
||||
* String Buffer for the screen output
|
||||
* @var string
|
||||
|
@ -107,6 +113,8 @@ class Console
|
|||
self::$logEnabled = $config->general('logging', false);
|
||||
}
|
||||
|
||||
self::$verboseLogEnabled = self::isVerboseLoggingEnabled();
|
||||
|
||||
// Greetings
|
||||
if ($showGreetings) {
|
||||
if (!self::$logEnabled) {
|
||||
|
@ -173,15 +181,17 @@ class Console
|
|||
{
|
||||
self::log(strip_tags($message));
|
||||
|
||||
self::$screenBuffer .= str_repeat("\t", $tabs)
|
||||
. strip_tags($message)
|
||||
. str_repeat(PHP_EOL, $newLine);
|
||||
if (!self::$verboseLogEnabled) {
|
||||
self::$screenBuffer .= str_repeat("\t", $tabs)
|
||||
. strip_tags($message)
|
||||
. str_repeat(PHP_EOL, $newLine);
|
||||
|
||||
$output = str_repeat("\t", $tabs)
|
||||
. Colors::color($message, self::$config)
|
||||
. str_repeat(PHP_EOL, $newLine);
|
||||
$output = str_repeat("\t", $tabs)
|
||||
. Colors::color($message, self::$config)
|
||||
. str_repeat(PHP_EOL, $newLine);
|
||||
|
||||
echo $output;
|
||||
echo $output;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -227,6 +237,10 @@ class Console
|
|||
|
||||
$message = date('Y-m-d H:i:s -- ') . $message;
|
||||
fwrite(self::$log, $message . PHP_EOL);
|
||||
|
||||
if (self::$verboseLogEnabled) {
|
||||
echo $message . PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -286,4 +300,15 @@ class Console
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if verbose logging is enabled
|
||||
* @return boolean
|
||||
*/
|
||||
protected static function isVerboseLoggingEnabled()
|
||||
{
|
||||
return self::$config->getParameter('verbose', false)
|
||||
|| self::$config->general('verbose_logging')
|
||||
|| self::$config->environmentConfig('verbose_logging', false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,9 +51,11 @@ mage releases rollback --release=-3 to:production
|
|||
# Rollback to a specific Release on the Production environment
|
||||
# mage releases rollback --release=20120101172148 to:production
|
||||
|
||||
# Output logs by adding verbose option to ANY command
|
||||
mage deploy to:production --verbose
|
||||
|
||||
### List of UPCOMING Commands ###
|
||||
# mage config add host s05.example.com to:[production]
|
||||
# mage config git git://github.com/andres-montanez/Zend-Framework-Twig-example-app.git
|
||||
# mage config svn svn://example.com/repo
|
||||
# mage task:deployment/rsync to:production
|
||||
# mage task:deployment/rsync to:production
|
||||
|
|
|
@ -21,3 +21,4 @@ tasks:
|
|||
- privileges
|
||||
- sampleTask
|
||||
- sampleTaskRollbackAware
|
||||
verbose_logging: true
|
||||
|
|
|
@ -29,3 +29,4 @@ tasks:
|
|||
# - sampleTask
|
||||
post-deploy:
|
||||
- sampleTask
|
||||
verbose_logging: false
|
||||
|
|
|
@ -3,6 +3,7 @@ name: My fantastic App
|
|||
email: andresmontanez@gmail.com
|
||||
notifications: true
|
||||
logging: true
|
||||
verbose_logging: false
|
||||
scm:
|
||||
type: git
|
||||
url: git://github.com/andres-montanez/Zend-Framework-Twig-example-app.git
|
||||
|
|
Loading…
Reference in a new issue