Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from __future__ import print_function

import atexit
import datetime
import logging
import sys
import threading
Expand Down Expand Up @@ -261,7 +262,7 @@ def enqueue(
"labels": labels,
"trace": trace,
"span_id": span_id,
"timestamp": datetime.utcfromtimestamp(record.created),
"timestamp": datetime.datetime.utcfromtimestamp(record.created),
}
)

Expand Down
10 changes: 8 additions & 2 deletions logging/tests/unit/handlers/transports/test_background_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import time
import logging
import unittest

Expand Down Expand Up @@ -243,7 +244,9 @@ def test__main_thread_terminated_non_empty_queue(self):
worker = self._make_one(_Logger(self.NAME))

self._start_with_thread_patch(worker)
worker.enqueue(mock.Mock(), "")
record = mock.Mock()
record.created = time.time()
worker.enqueue(record, "")
worker._main_thread_terminated()

self.assertFalse(worker.is_alive)
Expand All @@ -253,7 +256,9 @@ def test__main_thread_terminated_did_not_join(self):

self._start_with_thread_patch(worker)
worker._thread._terminate_on_join = False
worker.enqueue(mock.Mock(), "")
record = mock.Mock()
record.created = time.time()
worker.enqueue(record, "")
worker._main_thread_terminated()

self.assertFalse(worker.is_alive)
Expand Down Expand Up @@ -431,6 +436,7 @@ def log_struct(
labels=None,
trace=None,
span_id=None,
timestamp=None,
):
from google.cloud.logging.logger import _GLOBAL_RESOURCE

Expand Down