Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add zap with custom fields #46

Merged

Conversation

rfyiamcool
Copy link
Contributor

summary

I use klog implemented by zap, but klog-zap can't input custom params.

e.g. klog can record inputed server_name and server_version ?

expect

package main

import (
    "github.com/cloudwego/kitex/pkg/klog"
    kitexzap "github.com/kitex-contrib/obs-opentelemetry/logging/zap"
)

func main() {
    klog.SetLogger(kitexzap.NewLogger(kitexzap.WithCustomFields("service_name", "kitex", "version": "v1.0.1", "tags": "cloud.k8s")))
    klog.SetLevel(klog.LevelDebug)

    ...
    ...
}

@bytedance-oss-robot bytedance-oss-robot bot requested a review from CoderPoet April 22, 2024 15:02
@li-jin-gou
Copy link
Contributor

cc @rogerogers

Copy link
Collaborator

@rogerogers rogerogers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

logging/zap/logger.go Outdated Show resolved Hide resolved
Signed-off-by: rogerogers <[email protected]>
@rogerogers
Copy link
Collaborator

Hello, thank you very much for your PR. I've made a few minor adjustments to facilitate merging.

Copy link
Member

@CoderPoet CoderPoet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/LGTM

@bytedance-oss-robot bytedance-oss-robot bot added the lgtm Indicates that a PR is ready to be merged. label Apr 23, 2024
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CoderPoet, li-jin-gou, rfyiamcool, rogerogers

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@bytedance-oss-robot bytedance-oss-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 23, 2024
@bytedance-oss-robot bytedance-oss-robot bot merged commit 4bd94c0 into kitex-contrib:main Apr 23, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants