Skip to content
Draft
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
2 changes: 2 additions & 0 deletions src/deva/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
invoke_without_command=True,
external_plugins=True,
subcommands=(
"celian",
"config",
"env",
"log",
),
)
@click.rich_config(
Expand Down
16 changes: 16 additions & 0 deletions src/deva/cli/celian/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# SPDX-FileCopyrightText: 2024-present Datadog, Inc. <dev@datadoghq.com>
#
# SPDX-License-Identifier: MIT
from __future__ import annotations

from deva.cli.base import dynamic_group


@dynamic_group(
short_help="Test",
subcommands=(
"test",
),
)
def cmd() -> None:
pass
22 changes: 22 additions & 0 deletions src/deva/cli/celian/test/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# SPDX-FileCopyrightText: 2024-present Datadog, Inc. <dev@datadoghq.com>
#
# SPDX-License-Identifier: MIT
from __future__ import annotations

from typing import TYPE_CHECKING

import click

from deva.cli.base import dynamic_command
from deva.utils import logging

if TYPE_CHECKING:
from deva.cli.application import Application


@dynamic_command(short_help="Test")
@click.pass_obj
def cmd(app: Application) -> None:
"""Test."""
logging.error('My error message')

18 changes: 18 additions & 0 deletions src/deva/cli/log/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SPDX-FileCopyrightText: 2024-present Datadog, Inc. <dev@datadoghq.com>
#
# SPDX-License-Identifier: MIT
from __future__ import annotations

from deva.cli.base import dynamic_group


@dynamic_group(
short_help="Test",
subcommands=(
"error",
),
)

def cmd() -> None:
pass

22 changes: 22 additions & 0 deletions src/deva/cli/log/error/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# SPDX-FileCopyrightText: 2024-present Datadog, Inc. <dev@datadoghq.com>
#
# SPDX-License-Identifier: MIT
from __future__ import annotations

from typing import TYPE_CHECKING

import click

from deva.cli.base import dynamic_command
from deva.utils import logging

if TYPE_CHECKING:
from deva.cli.application import Application


@dynamic_command(short_help="Log error message")
@click.pass_obj
@click.argument('message', default='')
def cmd(app: Application, message: str) -> None:
"""Log error message."""
logging.error(app, message)
22 changes: 22 additions & 0 deletions src/deva/utils/logging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
def error(message: str):
"""Log error message."""

print(f"Error: {message}")


def warning(message: str):
"""Log error message."""

print(f"Warning: {message}")


def note(message: str):
"""Log note message."""

print(f"Note: {message}")


def info(message: str):
"""Log info message."""

print(f"Note: {message}")
Loading