feat: support caller skip in logx (#2401)

* feat: support caller skip in logx

* chore: remove debug prints

* chore: remove debug prints

* chore(deps): bump go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc (#2402)

Bumps [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc](https://github.com/open-telemetry/opentelemetry-go) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: simplify test code

* chore: remove new WithFields in logx, and deprecated old WithFields

* chore: simplify WithDuration

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
Kevin Wan
2022-09-17 22:48:24 +08:00
committed by GitHub
parent 1f6688e5c1
commit 0b1884b6bd
12 changed files with 297 additions and 520 deletions

View File

@@ -42,11 +42,18 @@ func captureOutput(f func()) string {
}
func getContent(jsonStr string) string {
var entry logEntry
var entry map[string]interface{}
json.Unmarshal([]byte(jsonStr), &entry)
val, ok := entry.Content.(string)
if ok {
return val
val, ok := entry[contentKey]
if !ok {
return ""
}
return ""
str, ok := val.(string)
if !ok {
return ""
}
return str
}