Documentation
¶
Index ¶
- Constants
- Variables
- func ConverPhoneToE164(phone string) string
- func ConvertPhoneToUsername(phone string) string
- func ConvertUsernameToPhones(uname string) (string, string)
- func GetCallerFunctionName(iStack int) string
- func InitUtils()
- func JoinDebug(elems []string) string
- func LoadDefaults()
- func LogAny(msgs ...any)
- func LogErr(err error, msgs ...any)
- func LogError(fn string, err error, msgs ...string)
- func LogErrorAny(fn string, err error, msgs ...any)
- func LogErrorStr(fn string, err error, msg string)
- func LogErrorStrReturn(fn string, err error, msg string) error
- func LogFormat(format string, v ...any)
- func LogInfoAny(fn string, level int, msgs ...any)
- func LogInfoAnyReturn(fn string, level int, err error, msgs ...any) error
- func LogInfoStr(fn string, level int, msgs ...string)
- func LogInfoStrReturn(fn string, level int, err error, msgs ...string) error
- func LogThis(msgs ...string)
Constants ¶
const ( LOG_ERROR = 1 LOG_NORMAL = 5 LOG_VERBOSE = 10 DB_ARRAY_FIELD_SEPARATOR = "|" ERROR_PREFIX = "!!!" WARNING_PREFIX = "---" COUNTRY_PHONE_SEPARATOR = "." COUNTRY_PHONE_PREFIX = "+" )
Variables ¶
var ( DEBUG_LEVEL int = 10 // 0 means no DEBUGGING info, higher number higher info // DEBUG_LEVEL = 5 DEBUG_PREFIX string = "#" DEBUG_SUFFIX string = "" DEBUG_VALUE string = ": " DEBUG_SEPARATOR string = ", " DEBUG_TRIM_FUNCTION bool = true // for GetCallerFunction, do we remove/trim the leading filename info etc? // JoinAlias func([]string, string) string = strings.Join // Aliases LogInfo func(string, int, ...string) = LogInfoStr )
Functions ¶
func ConverPhoneToE164 ¶
This is the format of E.164 phone: +[country_code][complete phone] Our format now is +[country_code].[complete phone] complete phone must be all number, cannot contain any symbols
func ConvertPhoneToUsername ¶
NOTE: Phone has to be informat +[country_code].[phone number without leading 0] This convert phone +62.812039124 to username = "62.81231241"
func ConvertUsernameToPhones ¶
NOT USED NOTE: maybe just removing the + sign, below is wrong! Convert username "62.8123512" to phone "+628123027521"
func GetCallerFunctionName ¶
To get previous caller need to pass 1 for stack, but since this is used inside the function that need to know the caller, we need to have 2. To get default, value use 0 as argument
func InitUtils ¶
func InitUtils()
No need to use this anymore because it was used only to seed math random generator Now since go 1.20 there is no need to do this anymore. If we need to initialize util in the future then use this again
func LogErr ¶
Default log error, which we get the caller function-stack default(1) NOTE: this disregard DEBUG_LEVEL and only print if there is error (!= nil)
func LogError ¶
Make console log (more readble code). Remember this doesn't use DEBUG_LEVEL, it always print as long there is error NOTE: not printing anything if there is no error
func LogErrorAny ¶
Make console log (more readble code). Remember this doesn't use DEBUG_LEVEL, it always print as long there is error NOTE: not printing anything if there is no error
func LogErrorStr ¶
Make console log (more readble code). Remember this doesn't use DEBUG_LEVEL, it always print as long there is error NOTE: not printing anything if there is no error
func LogInfoAny ¶
Only log, but not returning anything, message = any
func LogInfoAnyReturn ¶
Log MULTIPLE messages = any, and return error
func LogInfoStr ¶
Only log, but not returning anything, message = string
func LogInfoStrReturn ¶
Log MULTIPLE message = string and return error object NOTE: NOT USED
Types ¶
This section is empty.