//PrettyDecision pretty prints a swf.Decision in a readable form for logging.
481689
func PrettyDecision(d swf.Decision) string {
	var buffer bytes.Buffer
	buffer.WriteString("Decision{ ")
	if d.DecisionType != nil {
		buffer.WriteString(fmt.Sprintf("DecisionType: %s,", *d.DecisionType))
		if decisionTypes[*d.DecisionType](d) != nil {
			buffer.WriteString(fmt.Sprintf("%+v", decisionTypes[*d.DecisionType](d)))
		}
	} else {
		buffer.WriteString("NIL DECISION TYPE")
	}

	buffer.WriteString(" }")
	return buffer.String()
}
325796
func (s *FieldCapsService) Pretty(pretty bool) *FieldCapsService {
	s.pretty = pretty
	return s
}
1230959
func (s *SnapshotGetRepositoryService) Pretty(pretty bool) *SnapshotGetRepositoryService {
	s.pretty = pretty
	return s
}
354858
func (f *FSMContext) CompleteWorkflowDecision(data interface{}) *swf.Decision {
	return &swf.Decision{
		DecisionType: aws.String(swf.DecisionTypeCompleteWorkflowExecution),
		CompleteWorkflowExecutionDecisionAttributes: &swf.CompleteWorkflowExecutionDecisionAttributes{
			Result: aws.String(f.Serialize(data)),
		},
	}
}
202977
func (s *UpdateByQueryService) Pretty(pretty bool) *UpdateByQueryService {
	s.pretty = pretty
	return s
}
388900
func (s *SearchShardsService) Pretty(pretty bool) *SearchShardsService {
	s.pretty = pretty
	return s
}
618143
func (s *CatAllocationService) Pretty(pretty bool) *CatAllocationService {
	s.pretty = pretty
	return s
}
1081749
func (s *SnapshotVerifyRepositoryService) Pretty(pretty bool) *SnapshotVerifyRepositoryService {
	s.pretty = pretty
	return s
}
617675
func (s *MgetService) Pretty(pretty bool) *MgetService {
	s.pretty = pretty
	return s
}
1310221
func (s *PutScriptService) Pretty(pretty bool) *PutScriptService {
	s.pretty = pretty
	return s
}
312860
func (s *IndicesGetFieldMappingService) Pretty(pretty bool) *IndicesGetFieldMappingService {
	s.pretty = pretty
	return s
}
810615
func (s *AliasService) Pretty(pretty bool) *AliasService {
	s.pretty = pretty
	return s
}
899582
func AddDecision(decisionFn DecisionFunc) Decider {
	return func(ctx *FSMContext, h *swf.HistoryEvent, data interface{}) Outcome {
		decisions := ctx.EmptyDecisions()
		d := decisionFn(ctx, h, data)
		logf(ctx, "at=decide")
		decisions = append(decisions, d)
		return ctx.ContinueDecider(data, decisions)
	}
}
64184
func (s *TasksGetTaskService) Pretty(pretty bool) *TasksGetTaskService {
	s.pretty = pretty
	return s
}
947134
func (s *IndicesPutMappingService) Pretty(pretty bool) *IndicesPutMappingService {
	s.pretty = pretty
	return s
}
389605
func (s *IndicesForcemergeService) Pretty(pretty bool) *IndicesForcemergeService {
	s.pretty = pretty
	return s
}
1089567
func Pretty(w io.Writer, m *Module, opts ...PrettyOption) {
	fmt.Fprintln(w, "version:", m.Version)
	fmt.Fprintln(w, "types:")
	for _, fn := range m.Type.Functions {
		fmt.Fprintln(w, "  -", fn)
	}
	fmt.Fprintln(w, "imports:")
	for i, imp := range m.Import.Imports {
		if imp.Descriptor.Kind() == FunctionImportType {
			fmt.Printf("  - [%d] %v\n", i, imp)
		} else {
			fmt.Fprintln(w, "  -", imp)
		}
	}
	fmt.Fprintln(w, "functions:")
	for _, fn := range m.Function.TypeIndices {
		if fn >= uint32(len(m.Type.Functions)) {
			fmt.Fprintln(w, "  -", "???")
		} else {
			fmt.Fprintln(w, "  -", m.Type.Functions[fn])
		}
	}
	fmt.Fprintln(w, "exports:")
	for _, exp := range m.Export.Exports {
		fmt.Fprintln(w, "  -", exp)
	}
	fmt.Fprintln(w, "code:")
	for _, seg := range m.Code.Segments {
		fmt.Fprintln(w, "  -", seg)
	}
	fmt.Fprintln(w, "data:")
	for _, seg := range m.Data.Segments {
		fmt.Fprintln(w, "  -", seg)
	}
	if len(opts) == 0 {
		return
	}
	fmt.Fprintln(w)
	for _, opt := range opts {
		if opt.Contents {
			newline := false
			if len(m.Data.Segments) > 0 {
				fmt.Fprintln(w, "data section:")
				for _, seg := range m.Data.Segments {
					if newline {
						fmt.Fprintln(w)
					}
					fmt.Fprintln(w, hex.Dump(seg.Init))
					newline = true
				}
				newline = false
			}
			if len(m.Code.Segments) > 0 {
				fmt.Fprintln(w, "code section:")
				for _, seg := range m.Code.Segments {
					if newline {
						fmt.Fprintln(w)
					}
					fmt.Fprintln(w, hex.Dump(seg.Code))
					newline = true
				}
				newline = false
			}
		}
	}
}