Skip to content

Commit

Permalink
json mode without indent
Browse files Browse the repository at this point in the history
  • Loading branch information
sametd committed Nov 11, 2024
1 parent 4edae1d commit 6b35abb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions polytope_server/common/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

# Indexable fields
INDEXABLE_FIELDS = {"request_id": str}
DEFAULT_LOGGING_MODE = "prettyprint" # Changed from "json" to "prettyprint" or "console"
DEFAULT_LOGGING_MODE = "json"
DEFAULT_LOGGING_LEVEL = "INFO"


Expand Down Expand Up @@ -120,12 +120,14 @@ def format(self, record):

if self.mode == "logserver":
return self.format_for_logserver(record, result)
elif self.mode == "prettyprint":
if self.mode == "prettyprint":
return json.dumps(
result, indent=2, ensure_ascii=False
) # Added ensure_ascii=False for correct Unicode display
else:
if self.mode == "json":
return json.dumps(result, indent=None)
# default to json
return json.dumps(result, indent=None)


def setup(config, source_name):
Expand Down

0 comments on commit 6b35abb

Please sign in to comment.