func skipTagsWithField(tags []map[string]string, fields []string, context map[string]interface{}) { for _, tag := range tags { if field, skip := utils.TagHasAtLeastOneField(tag, fields); skip { if utils.DebugLevel(context) >= 10 { utils.Logger(context).Fprintln(os.Stderr, constants.MSG_SKIPPING_TAG_BECAUSE_HAS_FIELD, field) } tag[FIELD_SKIP] = TRUE } } }
func printProgressIfProgressEnabledAndMachineLogger(progressEnabled bool, context map[string]interface{}, progress float32) { if !progressEnabled { return } log := utils.Logger(context) if log.Name() == "machine" { log.Println(constants.MSG_PROGRESS, strconv.FormatFloat(float64(progress), 'f', 2, 32)) } }
func skipTagsWhere(tags []map[string]string, skipFunc skipFuncType, context map[string]interface{}) { for _, tag := range tags { if tag[FIELD_SKIP] != TRUE { skip := skipFunc(tag) if skip && utils.DebugLevel(context) >= 10 { utils.Logger(context).Fprintln(os.Stderr, constants.MSG_SKIPPING_TAG_WITH_REASON, tag[FIELD_FUNCTION_NAME], runtime.FuncForPC(reflect.ValueOf(skipFunc).Pointer()).Name()) } tag[FIELD_SKIP] = strconv.FormatBool(skip) } } }
func skipTagsWhere(tags []*types.CTag, skipFunc skipFuncType, context map[string]interface{}) { for _, tag := range tags { if !tag.SkipMe { skip := skipFunc(tag) if skip && utils.DebugLevel(context) >= 10 { utils.Logger(context).Fprintln(os.Stdout, constants.LOG_LEVEL_DEBUG, constants.MSG_SKIPPING_TAG_WITH_REASON, tag.FunctionName, runtime.FuncForPC(reflect.ValueOf(skipFunc).Pointer()).Name()) } tag.SkipMe = skip } } }
func removeDefinedProtypes(tags []map[string]string, context map[string]interface{}) { definedPrototypes := make(map[string]bool) for _, tag := range tags { if tag[FIELD_KIND] == KIND_PROTOTYPE { definedPrototypes[tag[KIND_PROTOTYPE]] = true } } for _, tag := range tags { if definedPrototypes[tag[KIND_PROTOTYPE]] { if utils.DebugLevel(context) >= 10 { utils.Logger(context).Fprintln(os.Stderr, constants.MSG_SKIPPING_TAG_ALREADY_DEFINED, tag[FIELD_FUNCTION_NAME]) } tag[FIELD_SKIP] = TRUE } } }
func removeDefinedProtypes(tags []*types.CTag, context map[string]interface{}) { definedPrototypes := make(map[string]bool) for _, tag := range tags { if tag.Kind == KIND_PROTOTYPE { definedPrototypes[tag.Prototype] = true } } for _, tag := range tags { if definedPrototypes[tag.Prototype] { if utils.DebugLevel(context) >= 10 { utils.Logger(context).Fprintln(os.Stdout, constants.LOG_LEVEL_DEBUG, constants.MSG_SKIPPING_TAG_ALREADY_DEFINED, tag.FunctionName) } tag.SkipMe = true } } }
func PrintRingNameIfDebug(context map[string]interface{}, command types.Command) { if utils.DebugLevel(context) >= 10 { utils.Logger(context).Fprintln(os.Stderr, constants.MSG_RUNNING_COMMAND, reflect.Indirect(reflect.ValueOf(command)).Type().Name()) } }
func PrintRingNameIfDebug(context map[string]interface{}, command types.Command) { if utils.DebugLevel(context) >= 10 { utils.Logger(context).Fprintln(os.Stdout, constants.LOG_LEVEL_DEBUG, constants.MSG_RUNNING_COMMAND, strconv.FormatInt(time.Now().Unix(), 10), reflect.Indirect(reflect.ValueOf(command)).Type().Name()) } }