github.com/iotexproject/iotex-core@v1.14.1-rc1/pkg/log/fields.go (about)

     1  // Copyright (c) 2019 IoTeX Foundation
     2  // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability
     3  // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed.
     4  // This source code is governed by Apache License 2.0 that can be found in the LICENSE file.
     5  
     6  // A warrper for Zerolog (https://github.com/rs/zerolog)
     7  //
     8  // Package log provides a global logger for zerolog.
     9  // derived from https://github.com/rs/zerolog/blob/master/log/log.go
    10  // putting here to get a better integration
    11  
    12  package log
    13  
    14  import (
    15  	"encoding/hex"
    16  
    17  	"go.uber.org/zap"
    18  )
    19  
    20  // Hex creates a zap field which convert binary to hex.
    21  func Hex(k string, d []byte) zap.Field {
    22  	return zap.String(k, hex.EncodeToString(d))
    23  }