github.com/wangyougui/gf/v2@v2.6.5/os/glog/glog_z_example_test.go (about) 1 // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/wangyougui/gf. 6 7 package glog_test 8 9 import ( 10 "context" 11 12 "github.com/wangyougui/gf/v2/frame/g" 13 ) 14 15 func ExampleContext() { 16 ctx := context.WithValue(context.Background(), "Trace-Id", "123456789") 17 g.Log().Error(ctx, "runtime error") 18 19 // May Output: 20 // 2020-06-08 20:17:03.630 [ERRO] {Trace-Id: 123456789} runtime error 21 // Stack: 22 // ... 23 }