diff --git a/aries_cloudagent/anoncreds/default/did_indy/registry.py b/aries_cloudagent/anoncreds/default/did_indy/registry.py index 567d90ccce..5bef819f82 100644 --- a/aries_cloudagent/anoncreds/default/did_indy/registry.py +++ b/aries_cloudagent/anoncreds/default/did_indy/registry.py @@ -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.""" diff --git a/aries_cloudagent/anoncreds/default/did_web/registry.py b/aries_cloudagent/anoncreds/default/did_web/registry.py index 63382f3606..0585e2b924 100644 --- a/aries_cloudagent/anoncreds/default/did_web/registry.py +++ b/aries_cloudagent/anoncreds/default/did_web/registry.py @@ -1,5 +1,6 @@ """DID Web Registry.""" +import logging import re from typing import Optional, Pattern, Sequence @@ -17,6 +18,8 @@ ) from ...models.anoncreds_schema import AnonCredsSchema, GetSchemaResult, SchemaResult +LOGGER = logging.getLogger(__name__) + class DIDWebRegistry(BaseAnonCredsResolver, BaseAnonCredsRegistrar): """DIDWebRegistry.""" @@ -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.""" diff --git a/aries_cloudagent/anoncreds/default/legacy_indy/registry.py b/aries_cloudagent/anoncreds/default/legacy_indy/registry.py index 5a2bf02acc..2d5d8026c4 100644 --- a/aries_cloudagent/anoncreds/default/legacy_indy/registry.py +++ b/aries_cloudagent/anoncreds/default/legacy_indy/registry.py @@ -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: diff --git a/aries_cloudagent/config/argparse.py b/aries_cloudagent/config/argparse.py index 717169e5d0..81fc4d291f 100644 --- a/aries_cloudagent/config/argparse.py +++ b/aries_cloudagent/config/argparse.py @@ -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.""" @@ -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 diff --git a/aries_cloudagent/core/conductor.py b/aries_cloudagent/core/conductor.py index 8706e55cda..c642d7de70 100644 --- a/aries_cloudagent/core/conductor.py +++ b/aries_cloudagent/core/conductor.py @@ -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"): + 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