Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added timestamp. #651

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
4 changes: 3 additions & 1 deletion src/blueapi/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ def main(ctx: click.Context, config: Path | None | tuple[Path, ...]) -> None:
loaded_config: ApplicationConfig = config_loader.load()

ctx.obj["config"] = loaded_config
logging.basicConfig(level=loaded_config.logging.level)
logging.basicConfig(
format="%(asctime)s - %(message)s", level=loaded_config.logging.level
)

if ctx.invoked_subcommand is None:
print("Please invoke subcommand!")
Expand Down
2 changes: 1 addition & 1 deletion src/blueapi/service/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def setup(config: ApplicationConfig) -> None:

# Eagerly initialize worker and messaging connection

logging.basicConfig(level=config.logging.level)
logging.basicConfig(format="%(asctime)s - %(message)s", level=config.logging.level)
worker()
stomp_client()

Expand Down
8 changes: 8 additions & 0 deletions src/blueapi/service/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,15 @@

def start(config: ApplicationConfig):
import uvicorn
from uvicorn.config import LOGGING_CONFIG

Check warning on line 335 in src/blueapi/service/main.py

View check run for this annotation

Codecov / codecov/patch

src/blueapi/service/main.py#L335

Added line #L335 was not covered by tests

LOGGING_CONFIG["formatters"]["default"]["fmt"] = (

Check warning on line 337 in src/blueapi/service/main.py

View check run for this annotation

Codecov / codecov/patch

src/blueapi/service/main.py#L337

Added line #L337 was not covered by tests
"%(asctime)s %(levelprefix)s %(message)s"
)
LOGGING_CONFIG["formatters"]["access"]["fmt"] = (

Check warning on line 340 in src/blueapi/service/main.py

View check run for this annotation

Codecov / codecov/patch

src/blueapi/service/main.py#L340

Added line #L340 was not covered by tests
"%(asctime)s %(levelprefix)s %(client_addr)s"
+ " - '%(request_line)s' %(status_code)s"
)
app.state.config = config
uvicorn.run(app, host=config.api.host, port=config.api.port)

Expand Down
Loading