mirror of
https://github.com/frappe/bench.git
synced 2025-01-09 08:30:39 +00:00
Merge pull request #1361 from ankush/warnings_output
fix(DX): make warnings go to stderr
This commit is contained in:
commit
871c703ee3
@ -123,7 +123,7 @@ def cli():
|
|||||||
bench_command()
|
bench_command()
|
||||||
|
|
||||||
if cmd_from_sys in bench_command.commands:
|
if cmd_from_sys in bench_command.commands:
|
||||||
with execute_cmd(check_for_update=not is_cli_command, command=command, logger=logger):
|
with execute_cmd(check_for_update=is_cli_command, command=command, logger=logger):
|
||||||
bench_command()
|
bench_command()
|
||||||
|
|
||||||
if in_bench:
|
if in_bench:
|
||||||
|
@ -79,7 +79,7 @@ def is_valid_frappe_branch(frappe_path: str, frappe_branch: str):
|
|||||||
raise InvalidRemoteException(f"Invalid frappe path: {frappe_path}") from e
|
raise InvalidRemoteException(f"Invalid frappe path: {frappe_path}") from e
|
||||||
|
|
||||||
|
|
||||||
def log(message, level=0, no_log=False):
|
def log(message, level=0, no_log=False, stderr=False):
|
||||||
import bench
|
import bench
|
||||||
import bench.cli
|
import bench.cli
|
||||||
|
|
||||||
@ -96,13 +96,13 @@ def log(message, level=0, no_log=False):
|
|||||||
bench.LOG_BUFFER.append({"prefix": prefix, "message": message, "color": color})
|
bench.LOG_BUFFER.append({"prefix": prefix, "message": message, "color": color})
|
||||||
|
|
||||||
if no_log:
|
if no_log:
|
||||||
click.secho(message, fg=color)
|
click.secho(message, fg=color, err=stderr)
|
||||||
else:
|
else:
|
||||||
loggers = {2: logger.error, 3: logger.warning}
|
loggers = {2: logger.error, 3: logger.warning}
|
||||||
level_logger = loggers.get(level, logger.info)
|
level_logger = loggers.get(level, logger.info)
|
||||||
|
|
||||||
level_logger(message)
|
level_logger(message)
|
||||||
click.secho(f"{prefix}: {message}", fg=color)
|
click.secho(f"{prefix}: {message}", fg=color, err=stderr)
|
||||||
|
|
||||||
|
|
||||||
def check_latest_version():
|
def check_latest_version():
|
||||||
@ -125,7 +125,7 @@ def check_latest_version():
|
|||||||
local_version = Version(VERSION)
|
local_version = Version(VERSION)
|
||||||
|
|
||||||
if pypi_version > local_version:
|
if pypi_version > local_version:
|
||||||
log(f"A newer version of bench is available: {local_version} → {pypi_version}")
|
log(f"A newer version of bench is available: {local_version} → {pypi_version}", stderr=True)
|
||||||
|
|
||||||
|
|
||||||
def pause_exec(seconds=10):
|
def pause_exec(seconds=10):
|
||||||
|
Loading…
Reference in New Issue
Block a user