Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(logger): set utf-8 encoding #223

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading