Skip to content

Conversation

@cdbartholomew
Copy link
Contributor

Summary

  • Add HINDSIGHT_API_LOG_FORMAT environment variable to configure log output format
  • Options: text (default, human-readable) and json (structured)
  • JSON format includes a severity field that logging systems can parse for proper log level categorization
  • Logs now write to stdout instead of stderr so log levels are correctly interpreted by external systems

Test plan

  • Verified JSON format outputs valid JSON with correct severity levels
  • Verified text format still works as expected
  • Ran existing tests - all pass
  • Test in local dev environment with HINDSIGHT_API_LOG_FORMAT=json

Add HINDSIGHT_API_LOG_FORMAT environment variable to configure log output
format. Options are "text" (default, human-readable) and "json" (structured).

JSON format outputs logs with a "severity" field that cloud logging systems
can parse for proper log level categorization. Also writes to stdout instead
of stderr so log levels are correctly interpreted.
EMBEDDING_DIMENSION = DEFAULT_EMBEDDING_DIMENSION


class GCPJsonFormatter(logging.Formatter):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just JsonFormatter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants