Use logger instead of print

... so that users can filter messages more easily.

Change-Id: I23cce4f2d0b2f8a133a0a2f9fc021266b4058663
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
Takashi Kajinami
2026-03-09 15:37:37 +09:00
parent a4e9a5d752
commit 5345d6e100
2 changed files with 10 additions and 5 deletions

View File

@@ -113,7 +113,7 @@ class ListQueues(command.Lister):
data, count = client.queues(**kwargs)
if count:
print("Queues in total: %s" % count)
self.log.debug("Queues in total: %s" % count)
columns = tuple(columns)
return (columns, (utils.get_item_properties(s, columns) for s in data))
@@ -1091,9 +1091,9 @@ class CreateSignedUrl(command.ShowOne):
paths = parsed_args.paths.split(',')
if not all([p in self.allowed_paths for p in paths]):
print("Invalid path supplied! Received {}. "
"Valid paths are: messages, subscriptions, "
"claims".format(','.join(paths)))
self.log.warning("Invalid path supplied! Received %s. "
"Valid paths are: messages, subscriptions, "
"claims", ','.join(paths))
kwargs = {
'methods': parsed_args.methods.split(','),

View File

@@ -15,6 +15,11 @@
import json
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
class Response:
"""Common response class for Zaqarclient.
@@ -51,5 +56,5 @@ class Response:
self._deserialized = json.loads(self.content)
return self._deserialized
except ValueError as ex:
print("Response is not a JSON object.", ex)
LOG.warning("Response is not a JSON object.: %s", ex)
return None