Skip to content

Commit

Permalink
fix(logger): set utf-8 encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
CorieW committed Dec 17, 2024
1 parent f516594 commit abfa1d5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
install_requires = [
'flask>=2.1.2', 'functions-framework>=3.0.0', 'firebase-admin>=6.0.0',
'pyyaml>=6.0', 'typing-extensions>=4.4.0', 'cloudevents==1.9.0',
'flask-cors>=3.0.10', 'pyjwt[crypto]>=2.5.0', 'google-events>=0.5.0',
'flask-cors>=3.0.10', 'pyjwt[crypto]>=2.5.0', 'google-events==0.5.0',
'google-cloud-firestore>=2.11.0'
]

Expand Down
6 changes: 6 additions & 0 deletions src/firebase_functions/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
import typing as _typing
import typing_extensions as _typing_extensions

# If encoding is not 'utf-8', change it to 'utf-8'.
if _sys.stdout.encoding != "utf-8":
_sys.stdout.reconfigure(encoding="utf-8") # type: ignore
if _sys.stderr.encoding != "utf-8":
_sys.stderr.reconfigure(encoding="utf-8") # type: ignore


class LogSeverity(str, _enum.Enum):
"""
Expand Down

0 comments on commit abfa1d5

Please sign in to comment.