File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
google/cloud/logging/handlers/transports
tests/unit/handlers/transports Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 2020from __future__ import print_function
2121
2222import atexit
23+ import datetime
2324import logging
2425import sys
2526import threading
@@ -261,7 +262,7 @@ def enqueue(
261262 "labels" : labels ,
262263 "trace" : trace ,
263264 "span_id" : span_id ,
264- "timestamp" : datetime .utcfromtimestamp (record .created ),
265+ "timestamp" : datetime .datetime . utcfromtimestamp (record .created ),
265266 }
266267 )
267268
Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15+ import time
1516import logging
1617import unittest
1718
@@ -243,7 +244,9 @@ def test__main_thread_terminated_non_empty_queue(self):
243244 worker = self ._make_one (_Logger (self .NAME ))
244245
245246 self ._start_with_thread_patch (worker )
246- worker .enqueue (mock .Mock (), "" )
247+ record = mock .Mock ()
248+ record .created = time .time ()
249+ worker .enqueue (record , "" )
247250 worker ._main_thread_terminated ()
248251
249252 self .assertFalse (worker .is_alive )
@@ -253,7 +256,9 @@ def test__main_thread_terminated_did_not_join(self):
253256
254257 self ._start_with_thread_patch (worker )
255258 worker ._thread ._terminate_on_join = False
256- worker .enqueue (mock .Mock (), "" )
259+ record = mock .Mock ()
260+ record .created = time .time ()
261+ worker .enqueue (record , "" )
257262 worker ._main_thread_terminated ()
258263
259264 self .assertFalse (worker .is_alive )
@@ -431,6 +436,7 @@ def log_struct(
431436 labels = None ,
432437 trace = None ,
433438 span_id = None ,
439+ timestamp = None ,
434440 ):
435441 from google .cloud .logging .logger import _GLOBAL_RESOURCE
436442
You can’t perform that action at this time.
0 commit comments