Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions example/console-app/bootstrap/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@

app: Application = Application(
base_path=Path(__file__).resolve().parent.parent,
providers=[
LogProvider,
ConsoleServiceProvider
]
providers=[LogProvider, ConsoleServiceProvider],
)
14 changes: 5 additions & 9 deletions example/console-app/commands/example_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,19 @@


class ExampleCommand(Command):
name ="hello"
name = "hello"
description = "This command greet the users."

arguments = [
argument(
"name",
description="Who do you want to greet?",
optional=True
)
argument("name", description="Who do you want to greet?", optional=True)
]

def handle(self):
name = self.argument('name')
name = self.argument("name")
if name:
text = 'Hello {}'.format(name)
text = "Hello {}".format(name)
else:
text = 'Hello'
text = "Hello"

# Example of showing loggings
Logger.info(text)
Expand Down
29 changes: 15 additions & 14 deletions example/console-app/config/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@

@dataclasses.dataclass
class LoggingConfig:
default: str = dataclasses.field(default_factory=lambda: env('LOG_CHANNEL', 'stack'))
default: str = dataclasses.field(
default_factory=lambda: env("LOG_CHANNEL", "stack")
)

channels: dict = dataclasses.field(default_factory=lambda: {
'stack': StackChannel(
driver='stack',
channels=['daily', 'terminal']
),
'daily': DailyChannel(
level=env('LOG_DAILY_LEVEL', 'debug'),
path=env('LOG_DAILY_PATH', 'storage/logs'),
),
'terminal': TerminalChannel(
level=env('LOG_TERMINAL_LEVEL', 'info'),
),
})
channels: dict = dataclasses.field(
default_factory=lambda: {
"stack": StackChannel(driver="stack", channels=["daily", "terminal"]),
"daily": DailyChannel(
level=env("LOG_DAILY_LEVEL", "debug"),
path=env("LOG_DAILY_PATH", "storage/logs"),
),
"terminal": TerminalChannel(
level=env("LOG_TERMINAL_LEVEL", "info"),
),
}
)
4 changes: 1 addition & 3 deletions example/console-app/providers/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ def register(self):
pass

def boot(self):
self.app.add_commands([
ExampleCommand
])
self.app.add_commands([ExampleCommand])
Loading