blob: d2a8a0d293ec2fc0aae7b83504c633a86cfba445 [file] [log] [blame]
Adrià Vilanova Martínez9f9ade52022-10-10 23:20:11 +02001# Copyright 2022 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4""""Helper methods for structured logging."""
5
6from __future__ import print_function
7from __future__ import division
8from __future__ import absolute_import
9
10import google.cloud.logging
11
12import settings
13
14
15def log(struct):
16 if settings.local_mode or settings.unit_test_mode:
17 return
18
19 logging_client = google.cloud.logging.Client()
20 logger = logging_client.logger('python')
21 logger.log_struct(struct)