Skip to content

Commit

Permalink
Upgrade go-helper version
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Cataldo committed Mar 28, 2024
1 parent b61b2ca commit 552b66f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ go-logger
=================
<img align="right" src="gopher-logger.png" alt="">

[![Project status](https://img.shields.io/badge/version-v1.2.8-vividgreen.svg)](https://github.com/GabrielHCataldo/go-logger/releases/tag/v1.2.8)
[![Project status](https://img.shields.io/badge/version-v1.2.9-vividgreen.svg)](https://github.com/GabrielHCataldo/go-logger/releases/tag/v1.2.9)
[![Go Report Card](https://goreportcard.com/badge/github.com/GabrielHCataldo/go-logger)](https://goreportcard.com/report/github.com/GabrielHCataldo/go-logger)
[![Coverage Status](https://coveralls.io/repos/GabrielHCataldo/go-logger/badge.svg?branch=main&service=github)](https://coveralls.io/github/GabrielHCataldo/go-logger?branch=main)
[![Open Source Helpers](https://www.codetriage.com/gabrielhcataldo/go-logger/badges/users.svg)](https://www.codetriage.com/gabrielhcataldo/go-logger)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21.3
require github.com/iancoleman/orderedmap v0.3.0

require (
github.com/GabrielHCataldo/go-helper v1.3.7
github.com/GabrielHCataldo/go-helper v1.6.6
github.com/cockroachdb/apd v1.1.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/go-playground/locales v0.14.1 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ github.com/GabrielHCataldo/go-helper v1.3.4 h1:Rcf7gRbk6oI/YrZMIcieOotA2nldAoIje
github.com/GabrielHCataldo/go-helper v1.3.4/go.mod h1:+whI36aUg1BfvLpZWJ8j81+d5iPuxl58ApOJqTIliCU=
github.com/GabrielHCataldo/go-helper v1.3.7 h1:aAUdFNJJyx6YCx9q4+1qaO/jmBkztDwwZiLtnip0kcI=
github.com/GabrielHCataldo/go-helper v1.3.7/go.mod h1:+whI36aUg1BfvLpZWJ8j81+d5iPuxl58ApOJqTIliCU=
github.com/GabrielHCataldo/go-helper v1.6.6 h1:fpfsFBd5GERzNjd+QoNJKt52bIidH9gmZsmbPiBD6ho=
github.com/GabrielHCataldo/go-helper v1.6.6/go.mod h1:0lWjHErv57Qkk+w25kbYKTmZYrNe0/0q0wUlt00OmRg=
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
20 changes: 10 additions & 10 deletions logger/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ func printJsonMsg(logger *log.Logger, lvl level, skipCaller int, opts Options, f
func processMsgValue(value any, tag string, opts Options) any {
var processedValue any
isSub := helper.Equals(opts.Mode, ModeJson) && opts.EnableJsonMsgFieldForSlice
if helper.IsStruct(value) {
if helper.IsStructType(value) {
processedValue = prepareStructMsg(value, isSub, tag)
} else if helper.IsMap(value) {
} else if helper.IsMapType(value) {
processedValue = prepareMapMsg(value, isSub, tag)
} else if helper.IsSlice(value) {
} else if helper.IsSliceType(value) {
processedValue = prepareSliceMsg(value, isSub, tag)
} else {
processedValue = prepareValue(value, tag)
Expand All @@ -205,7 +205,7 @@ func prepareStructMsg(value any, sub bool, tag string) any {
}
if helper.IsNotNil(fieldValue.Interface()) {
fieldRealValue = fieldValue.Interface()
if (helper.IsPointer(fieldRealValue) || helper.IsInterface(fieldRealValue)) &&
if (helper.IsPointerType(fieldRealValue) || helper.IsInterfaceType(fieldRealValue)) &&
helper.IsNotNil(fieldValue.Elem().Interface()) {
fieldRealValue = fieldValue.Elem().Interface()
}
Expand Down Expand Up @@ -242,7 +242,7 @@ func prepareMapMsg(value any, sub bool, tag string) any {
var mRealValue any
if mValue.CanInterface() && helper.IsNotNil(mValue.Interface()) {
mRealValue = mValue.Interface()
if (helper.IsPointer(mRealValue) || helper.IsInterface(mRealValue)) &&
if (helper.IsPointerType(mRealValue) || helper.IsInterfaceType(mRealValue)) &&
helper.IsNotNil(mValue.Elem().Interface()) {
mRealValue = mValue.Elem().Interface()
}
Expand All @@ -266,7 +266,7 @@ func prepareSliceMsg(value any, sub bool, tag string) any {
indexValue := v.Index(i)
if indexValue.CanInterface() && helper.IsNotNil(indexValue.Interface()) {
indexRealValue = indexValue.Interface()
if (helper.IsPointer(indexRealValue) || helper.IsInterface(indexRealValue)) &&
if (helper.IsPointerType(indexRealValue) || helper.IsInterfaceType(indexRealValue)) &&
helper.IsNotNil(indexValue.Elem().Interface()) {
indexRealValue = indexValue.Elem().Interface()
}
Expand Down Expand Up @@ -392,11 +392,11 @@ func prepareMessageColor(lvl level, msg ...any) []any {
}

func prepareValue(value any, tag string) any {
if helper.IsStruct(value) {
if helper.IsStructType(value) {
return prepareStructMsg(value, true, tag)
} else if helper.IsMap(value) {
} else if helper.IsMapType(value) {
return prepareMapMsg(value, true, tag)
} else if helper.IsSlice(value) {
} else if helper.IsSliceType(value) {
return prepareSliceMsg(value, true, tag)
} else if helper.IsNotNil(value) {
return convertValueToString(value, tag)
Expand Down Expand Up @@ -457,7 +457,7 @@ func getCurrentTime(useUTC bool) time.Time {
func reflectValueOf(value any) (reflect.Value, reflect.Type) {
v := reflect.ValueOf(value)
t := reflect.TypeOf(value)
if helper.IsPointer(value) || helper.IsInterface(value) {
if helper.IsPointerType(value) || helper.IsInterfaceType(value) {
v = v.Elem()
t = t.Elem()
}
Expand Down

0 comments on commit 552b66f

Please sign in to comment.