//GetLogger function will return the logger object for that package
GetLogger function will return the logger object for that package
// GetLogger function will return the logger object for that package
func GetLogger() *Logger {
	mutex.Lock()
	defer mutex.Unlock()
	pc, _, _, _ := runtime.Caller(1)
	details := runtime.FuncForPC(pc)
	fnNameSplit := strings.Split(details.Name(), "/") 
	pkgFnName := strings.Split(fnNameSplit[len(fnNameSplit)-1], ".")
	pkgName := pkgFnName[0]
	if _, ok := loggers[pkgName]; !ok {
		Level := logConfig.DefaultLvl
		if logConfig.PkgConfigs != nil && len(logConfig.PkgConfigs) > 0 {
			for _, pkgConfig := range logConfig.PkgConfigs {
				if pkgConfig.PackageName == pkgName {
					Level = pkgConfig.Level
				}
			}
		}
		logger := &Logger{
			sev:             LevelsMap[Level],
			pkgName:         pkgName,
			includeFunction: logConfig.IncludeFunction,
			includeLine:     logConfig.IncludeLineNum,
		}
		_ = logger.updateLvlFlags()
		loggers[pkgName] = logger
	}
	return loggers[pkgName]
}
func GetLogger ( ) * Logger { mutex . Lock ( ) defer mutex . Unlock ( ) pc , _ , _ , _ := runtime . Caller ( 1 ) details := runtime . FuncForPC ( pc ) fnNameSplit := strings . Split ( details . Name ( ) , " " ) pkgFnName := strings . Split ( fnNameSplit [ len ( fnNameSplit ) - 1 ] , " " ) pkgName := pkgFnName [ 0 ] if _ , ok := loggers [ pkgName ] ; ! ok { Level := logConfig . DefaultLvl if logConfig . PkgConfigs != nil && len ( logConfig . PkgConfigs ) > 0 { for _ , pkgConfig := range logConfig . PkgConfigs { if pkgConfig . PackageName == pkgName { Level = pkgConfig . Level } } } logger := & Logger { sev : LevelsMap [ Level ] , pkgName : pkgName , includeFunction : logConfig . IncludeFunction , includeLine : logConfig . IncludeLineNum , } _ = logger . updateLvlFlags ( ) loggers [ pkgName ] = logger } return loggers [ pkgName ] }
GetLogger function will return the logger object for that package
GetLogger function will return the logger object for that package
//TODO update the separator later