diff --git a/README.md b/README.md index 4fe691f..46e6914 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ go-logger ================= -[![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) diff --git a/go.mod b/go.mod index 221c21f..70964de 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index d071816..f191759 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/logger/core.go b/logger/core.go index 0e0433e..6a41e13 100644 --- a/logger/core.go +++ b/logger/core.go @@ -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) @@ -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() } @@ -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() } @@ -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() } @@ -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) @@ -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() }