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

introduce ACAPY_NO_BANNER--no-banner and replace print statements by logging in plugins #3203

Closed
Closed
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: 1 addition & 1 deletion aries_cloudagent/anoncreds/default/did_indy/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def supported_identifiers_regex(self) -> Pattern:

async def setup(self, context: InjectionContext):
"""Setup."""
print("Successfully registered DIDIndyRegistry")
LOGGER.info("Successfully registered DIDIndyRegistry")

async def get_schema(self, profile: Profile, schema_id: str) -> GetSchemaResult:
"""Get a schema from the registry."""
Expand Down
5 changes: 4 additions & 1 deletion aries_cloudagent/anoncreds/default/did_web/registry.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""DID Web Registry."""

import logging
import re
from typing import Optional, Pattern, Sequence

Expand All @@ -17,6 +18,8 @@
)
from ...models.anoncreds_schema import AnonCredsSchema, GetSchemaResult, SchemaResult

LOGGER = logging.getLogger(__name__)


class DIDWebRegistry(BaseAnonCredsResolver, BaseAnonCredsRegistrar):
"""DIDWebRegistry."""
Expand All @@ -40,7 +43,7 @@ def supported_identifiers_regex(self) -> Pattern:

async def setup(self, context: InjectionContext):
"""Setup."""
print("Successfully registered DIDWebRegistry")
LOGGER.info("Successfully registered DIDWebRegistry")

async def get_schema(self, profile, schema_id: str) -> GetSchemaResult:
"""Get a schema from the registry."""
Expand Down
2 changes: 1 addition & 1 deletion aries_cloudagent/anoncreds/default/legacy_indy/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def supported_identifiers_regex(self) -> Pattern:

async def setup(self, context: InjectionContext):
"""Setup."""
print("Successfully registered LegacyIndyRegistry")
LOGGER.info("Successfully registered LegacyIndyRegistry")

@staticmethod
def make_schema_id(schema: AnonCredsSchema) -> str:
Expand Down
8 changes: 8 additions & 0 deletions aries_cloudagent/config/argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,13 @@ def add_arguments(self, parser: ArgumentParser):
"('debug', 'info', 'warning', 'error', 'critical')"
),
)
parser.add_argument(
"--no-banner",
action="store_true",
env_var="ACAPY_NO_BANNER",
default=False,
help=("Suppress banner in logs"),
)

def get_settings(self, args: Namespace) -> dict:
"""Extract logging settings."""
Expand All @@ -1038,6 +1045,7 @@ def get_settings(self, args: Namespace) -> dict:
settings["log.file"] = args.log_file
if args.log_level:
settings["log.level"] = args.log_level
settings["log.banner"] = not args.no_banner
return settings


Expand Down
35 changes: 18 additions & 17 deletions aries_cloudagent/core/conductor.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,24 +318,25 @@ async def start(self) -> None:
# Get agent label
default_label = context.settings.get("default_label")

if context.settings.get("transport.disabled"):
LoggingConfigurator.print_banner(
default_label,
None,
None,
self.setup_public_did and self.setup_public_did.did,
self.admin_server,
)
else:
LoggingConfigurator.print_banner(
default_label,
self.inbound_transport_manager.registered_transports,
self.outbound_transport_manager.registered_transports,
self.setup_public_did and self.setup_public_did.did,
self.admin_server,
)
if context.settings.get("log.banner", True):
if context.settings.get("transport.disabled"):
LoggingConfigurator.print_banner(
default_label,
None,
None,
self.setup_public_did and self.setup_public_did.did,
self.admin_server,
)
else:
LoggingConfigurator.print_banner(
default_label,
self.inbound_transport_manager.registered_transports,
self.outbound_transport_manager.registered_transports,
self.setup_public_did and self.setup_public_did.did,
self.admin_server,
)

LoggingConfigurator.print_notices(context.settings)
LoggingConfigurator.print_notices(context.settings)

# record ACA-Py version in Wallet, if needed
from_version_storage = None
Expand Down
Loading