24 lines
615 B
Python
24 lines
615 B
Python
import functions_framework
|
|
from utils.custom_logger import get_logger
|
|
|
|
logger = get_logger(__name__)
|
|
|
|
|
|
@functions_framework.cloud_event
|
|
def hello_pubsub(cloud_event):
|
|
logger.info("Cloud Function triggered")
|
|
data = cloud_event.data
|
|
logger.info(f"Received data: {data}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
# For local testing purposes
|
|
class DummyCloudEvent:
|
|
"""デバッグ用のダミークラウドイベントクラス"""
|
|
def __init__(self, data):
|
|
self.data = data
|
|
|
|
test_event = DummyCloudEvent(data={"message": "Hello from local test"})
|
|
hello_pubsub(test_event)
|
|
|