Skip to content

Commit 2b8f15b

Browse files
committed
log to stderr, results to stdout
1 parent bc65041 commit 2b8f15b

4 files changed

Lines changed: 10 additions & 32 deletions

File tree

VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

dataall_cli/__init__.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,12 @@
1616

1717
from dataall_core.profile import CONFIG_PATH
1818

19-
from .__metadata__ import ( # noqa: F401
20-
__description__,
21-
__license__,
22-
__title__,
23-
__version__,
19+
logging.basicConfig(
20+
stream=sys.stderr,
21+
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
22+
level=os.environ.get("dataall_cli_loglevel", "INFO").upper(),
2423
)
2524

26-
root_logger = logging.getLogger("dataall_cli")
27-
root_logger.setLevel(os.environ.get("dataall_cli_loglevel", "INFO").upper())
28-
29-
handler = logging.StreamHandler(sys.stdout)
30-
handler.setFormatter(
31-
logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
32-
)
33-
root_logger.addHandler(handler)
34-
3525
DA_CONFIG_PATH = os.getenv("dataall_config_path", CONFIG_PATH)
3626
CREDS_PATH = os.getenv("dataall_creds_path", None)
3727
SCHEMA_PATH = os.getenv("dataall_schema_path", None)

dataall_cli/__metadata__.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

dataall_cli/cli.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
from dataall_core.dataall_client import DataallClient
1010
from dataall_core.profile import CONFIG_PATH
1111

12-
from .bind_commands import bind
13-
from .utils import save_config
12+
from dataall_cli.bind_commands import bind
13+
from dataall_cli.utils import save_config
1414

1515
DA_CONFIG_PATH = os.getenv("dataall_config_path", CONFIG_PATH)
1616
CREDS_PATH = os.getenv("dataall_creds_path", None)
@@ -36,7 +36,7 @@
3636
@click.group(name="dataall_cli", invoke_without_command=True)
3737
def dataall_cli() -> None:
3838
"""data.all cli groups."""
39-
click.echo("Executing dataall_cli.")
39+
click.echo("Executing dataall_cli.", err=True)
4040
pass
4141

4242

@@ -112,7 +112,7 @@ def configure(
112112
profile: str,
113113
) -> None:
114114
"""Configure data.all client for a given user, use profile to setup multiple user profiles."""
115-
click.echo("Configuring data.all CLI...")
115+
click.echo("Configuring data.all CLI...", err=True)
116116

117117
try:
118118
profile_params_dict = {
@@ -143,6 +143,6 @@ def configure(
143143
params_dict=profile_params_dict,
144144
config_path=Path(DA_CONFIG_PATH),
145145
)
146-
click.echo("data.all CLI configured successfully.")
146+
click.echo("data.all CLI configured successfully.", err=True)
147147
except Exception as e:
148-
click.echo(f"An error occurred: {e}")
148+
click.echo(f"An error occurred: {e}", err=True)

0 commit comments

Comments
 (0)