// panicHandler is what is called by panicwrap when a panic is encountered
// within Terraform. It is guaranteed to run after the resulting process has
// exited so we can take the log file, add in the panic, and store it
// somewhere locally.
776681
func panicHandler(logF *os.File) panicwrap.HandlerFunc {
	return func(m string) {
		// Right away just output this thing on stderr so that it gets
		// shown in case anything below fails.
		fmt.Fprintf(os.Stderr, fmt.Sprintf("%s\n", m))

		// Create the crash log file where we'll write the logs
		f, err := os.Create("crash.log")
		if err != nil {
			fmt.Fprintf(os.Stderr, "Failed to create crash log file: %s", err)
			return
		}
		defer f.Close()

		// Seek the log file back to the beginning
		if _, err = logF.Seek(0, 0); err != nil {
			fmt.Fprintf(os.Stderr, "Failed to seek log file for crash: %s", err)
			return
		}

		// Copy the contents to the crash file. This will include
		// the panic that just happened.
		if _, err = io.Copy(f, logF); err != nil {
			fmt.Fprintf(os.Stderr, "Failed to write crash log: %s", err)
			return
		}

		// Tell the user a crash occurred in some helpful way that
		// they'll hopefully notice.
		fmt.Printf("\n\n")
		fmt.Println(strings.TrimSpace(panicOutput))
	}
}
734824
func (l *Logger) Panicf(format string, args ...interface{}) {
	l.logger().Panicf(format, args...)
}
915588
func (l *Slog) Panic(v ...interface{}) {
	l = l.copy()
	l.Log.di(fnLevelDi)
	msg := fmt.Sprint(v...)
	l.Log.Message(msg)
	l.Log.Priority = PanicPrio
	l.commit()
	l.Writter.Close()
	panic(msg)
}
998103
func (b *Base) ErrorHandler(err error, m message.Composer) {
	b.mutex.RLock()
	defer b.mutex.RUnlock()

	b.errHandler(err, m)
}
377508
func (l logger) Panicf(format string, args ...interface{}) {
	l.sourced().Panicf(format, args...)
}
4688
func Panic(a ...interface{}) {
	Log(a...)
	panic(strings.TrimSpace(fmt.Sprintln(a...)))
}
1181142
func (r *Router) UseHandler(handler http.Handler) *Router {
	r.Route("/*").All(handler.ServeHTTP)
	return r
}
225755
func (ref *Consumer) messageHandler(in <-chan *sarama.ConsumerMessage) {
	ref.Debug("messageHandler started ...")
	var prevValue []byte

	for {
		select {
		case msg := <-in:
			if msg == nil {
				continue
			}
			consumerMsg := &ConsumerMessage{
				Key:       msg.Key,
				Value:     msg.Value,
				PrevValue: prevValue,
				Topic:     msg.Topic,
				Partition: msg.Partition,
				Offset:    msg.Offset,
				Timestamp: msg.Timestamp,
			}
			// Store value as previous for the next iteration
			prevValue = consumerMsg.Value
			select {
			case ref.Config.RecvMessageChan <- consumerMsg:
			case <-time.After(1 * time.Second):
				ref.Warn("Failed to deliver a message")
			}
		case <-ref.closeChannel:
			ref.Debug("Canceling message handler")
			return
		}
	}
}
382311
func (entry *Entry) Panic(args ...interface{}) {
	if entry.lgEntry.Logger.Level >= lg.PanicLevel {
		entry.lgEntry.WithFields(entry.fields).Panic(args...)
	}
}
391258
func HandlerErrorHandler(errorHandler transport.ErrorHandler) HandlerOption {
	return func(h *Handler) { h.errorHandler = errorHandler }
}
81884
func (me *Logger) Panic(v ...interface{}) {
	me.setFullPrefix(Pfatal)
	me.logger.Panic(v...)
}
1144725
func Panic(v ...interface{}) {
	s := fmt.Sprint(v...)
	Logger.Output(2, s)
	panic(s)
}
962965
func WrapHandler(h *webdav.Handler, confs ...func(c *Config)) gin.HandlerFunc {
	defaultConfig := &Config{
		URL: "doc.json",
	}

	for _, c := range confs {
		c(defaultConfig)
	}

	return CustomWrapHandler(defaultConfig, h)
}
76141
func (p *asyncProducer) retryHandler() {
	var msg *ProducerMessage
	buf := queue.New()

	for {
		if buf.Length() == 0 {
			msg = <-p.retries
		} else {
			select {
			case msg = <-p.retries:
			case p.input <- buf.Peek().(*ProducerMessage):
				buf.Remove()
				continue
			}
		}

		if msg == nil {
			return
		}

		buf.Add(msg)
	}
}
400857
func (l *Logger) PanicE(msg string, e error) {
	l.Panic(l.formatErr(e, msg))
}
261378
func panicHandler(w http.ResponseWriter, r *http.Request, rcv interface{}) {
	ctx := r.Context()
	pe := &platform.Error{
		Code: platform.EInternal,
		Msg:  "a panic has occurred",
		Err:  fmt.Errorf("%v", rcv),
	}

	EncodeError(ctx, pe, w)
}
887476
func (rl *RevelLogger) Panic(msg string, ctx ...interface{}) {
	rl.Crit(msg, ctx...)
	panic(msg)
}