Skip to content

Commit

Permalink
Merge pull request #453 from jolicode/better-logs
Browse files Browse the repository at this point in the history
Better log output in debug mode (`-vvv`)
  • Loading branch information
lyrixx committed May 6, 2024
2 parents cf197cb + 5c36964 commit b696fed
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 26 deletions.
31 changes: 22 additions & 9 deletions CHANGELOG.md
Expand Up @@ -2,24 +2,37 @@

## Not released yet

### Features

* Totally rework the import feature. Castor use special `castor.composer.json`
file to handle imports. This fixes many bugs and issues with the previous
* Marked SSH features as stable
* Add `?callable $callback = null` param to `ssh_*` functions to manipulate
output
* Add support for SSH connection without specifying a user
* SSH
* Marked SSH features as stable
* Add `?callable $callback = null` param to `ssh_*` functions to manipulate
output
* Add support for SSH connection without specifying a user
* Add `context()` function in expression language to enable a task
* Better handling of notification errors and exceptions
* Deprecate `Castor\GlobalHelper` class. There are no replacements. Use raw
functions instead
* Deprecate `AfterApplicationInitializationEvent` event. Use
`FunctionsResolvedEvent` instead.
* Add `notificationTitle` property to `Context` to set the application name for
notifications title

### Minor

* Better handling of notification errors and exceptions
* Better log output in debug mode (`-vvv`)
* Changed the behavior of `notify` parameter in `Context` to be a nullable boolean.
- `null` is now the default value (only user notifications are displayed).
- `true` to enable notifications globally (user and Castor generated notifications)
- `false` to disable them globally

### Deprecations

* Deprecate `Castor\GlobalHelper` class. There are no replacements. Use raw
functions instead
* Deprecate `AfterApplicationInitializationEvent` event. Use
`FunctionsResolvedEvent` instead

### Fixes

* Fix root location when repacking application

## 0.15.0 (2024-04-03)
Expand Down
11 changes: 2 additions & 9 deletions src/Console/ApplicationFactory.php
Expand Up @@ -7,10 +7,6 @@
use Castor\Console\Command\DebugCommand;
use Castor\Console\Command\RepackCommand;
use Castor\Container;
use Castor\Descriptor\DescriptorsCollection;
use Castor\Event\AfterApplicationInitializationEvent;
use Castor\Event\FunctionsResolvedEvent;
use Castor\ExpressionLanguage;
use Castor\Helper\PathHelper;
use Castor\Helper\PlatformHelper;
use Castor\Monolog\Processor\ProcessProcessor;
Expand Down Expand Up @@ -42,6 +38,7 @@
use Symfony\Component\String\Slugger\AsciiSlugger;
use Symfony\Component\VarDumper\Cloner\AbstractCloner;
use Symfony\Contracts\Cache\CacheInterface;
use Symfony\Contracts\EventDispatcher\Event;
use Symfony\Contracts\HttpClient\HttpClientInterface;

use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
Expand Down Expand Up @@ -86,12 +83,8 @@ private static function configureDebug(): ErrorHandler
{
$errorHandler = ErrorHandler::register();

AbstractCloner::$defaultCasters[self::class] = ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'];
AbstractCloner::$defaultCasters[AfterApplicationInitializationEvent::class] = ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'];
AbstractCloner::$defaultCasters[Application::class] = ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'];
AbstractCloner::$defaultCasters[DescriptorsCollection::class] = ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'];
AbstractCloner::$defaultCasters[ExpressionLanguage::class] = ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'];
AbstractCloner::$defaultCasters[FunctionsResolvedEvent::class] = ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'];
AbstractCloner::$defaultCasters[Event::class] = ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'];

return $errorHandler;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Event/AfterApplicationInitializationEvent.php
Expand Up @@ -4,11 +4,12 @@

use Castor\Console\Application;
use Castor\Descriptor\TaskDescriptorCollection;
use Symfony\Contracts\EventDispatcher\Event;

/**
* @deprecated since Castor 0.16, use FunctionsResolvedEvent instead
*/
class AfterApplicationInitializationEvent
class AfterApplicationInitializationEvent extends Event
{
public function __construct(
public readonly Application $application,
Expand Down
3 changes: 2 additions & 1 deletion src/Event/AfterExecuteTaskEvent.php
Expand Up @@ -3,8 +3,9 @@
namespace Castor\Event;

use Castor\Console\Command\TaskCommand;
use Symfony\Contracts\EventDispatcher\Event;

class AfterExecuteTaskEvent
class AfterExecuteTaskEvent extends Event
{
public function __construct(
public readonly TaskCommand $task,
Expand Down
3 changes: 2 additions & 1 deletion src/Event/BeforeBootEvent.php
Expand Up @@ -3,9 +3,10 @@
namespace Castor\Event;

use Castor\Console\Application;
use Symfony\Contracts\EventDispatcher\Event;

/** @internal */
class BeforeBootEvent
class BeforeBootEvent extends Event
{
public function __construct(
public readonly Application $application,
Expand Down
3 changes: 2 additions & 1 deletion src/Event/BeforeExecuteTaskEvent.php
Expand Up @@ -3,8 +3,9 @@
namespace Castor\Event;

use Castor\Console\Command\TaskCommand;
use Symfony\Contracts\EventDispatcher\Event;

class BeforeExecuteTaskEvent
class BeforeExecuteTaskEvent extends Event
{
public function __construct(
public readonly TaskCommand $task,
Expand Down
3 changes: 2 additions & 1 deletion src/Event/FunctionsResolvedEvent.php
Expand Up @@ -4,8 +4,9 @@

use Castor\Descriptor\SymfonyTaskDescriptor;
use Castor\Descriptor\TaskDescriptor;
use Symfony\Contracts\EventDispatcher\Event;

class FunctionsResolvedEvent
class FunctionsResolvedEvent extends Event
{
/**
* @param list<TaskDescriptor> $taskDescriptors
Expand Down
3 changes: 2 additions & 1 deletion src/Event/ProcessCreatedEvent.php
Expand Up @@ -3,8 +3,9 @@
namespace Castor\Event;

use Symfony\Component\Process\Process;
use Symfony\Contracts\EventDispatcher\Event;

class ProcessCreatedEvent
class ProcessCreatedEvent extends Event
{
public function __construct(
public readonly Process $process,
Expand Down
3 changes: 2 additions & 1 deletion src/Event/ProcessStartEvent.php
Expand Up @@ -3,8 +3,9 @@
namespace Castor\Event;

use Symfony\Component\Process\Process;
use Symfony\Contracts\EventDispatcher\Event;

class ProcessStartEvent
class ProcessStartEvent extends Event
{
public function __construct(
public readonly Process $process,
Expand Down
3 changes: 2 additions & 1 deletion src/Event/ProcessTerminateEvent.php
Expand Up @@ -3,8 +3,9 @@
namespace Castor\Event;

use Symfony\Component\Process\Process;
use Symfony\Contracts\EventDispatcher\Event;

class ProcessTerminateEvent
class ProcessTerminateEvent extends Event
{
public function __construct(
public readonly Process $process,
Expand Down

0 comments on commit b696fed

Please sign in to comment.