// Itol converts an integer to a logo.Level
// TODO is it possible to cast somehow?
494477
func Itol(level int) Level {
	switch level {
	case 0:
		return DEBUG
	case 1:
		return INFO
	case 2:
		return WARN
	case 3:
		return ERROR
	case 4:
		return FATAL
	default:
		return DEBUG
	}
}
1312160
func Infoln(v ...interface{}) {
	std.Fprint(std.flags, LEVEL_INFO, 2, fmt.Sprintln(v...), nil)
}
318062
func Itoa(i int) string {
	var buf [20]byte
	return ByteString(GetIntBytes(buf[:], int64(i)))
}
538527
func (s *stdlogAdapter) pickLevel(str string) (Level, string) {
	switch {
	case strings.HasPrefix(str, "[DEBUG]"):
		return Debug, strings.TrimSpace(str[7:])
	case strings.HasPrefix(str, "[TRACE]"):
		return Trace, strings.TrimSpace(str[7:])
	case strings.HasPrefix(str, "[INFO]"):
		return Info, strings.TrimSpace(str[6:])
	case strings.HasPrefix(str, "[WARN]"):
		return Warn, strings.TrimSpace(str[7:])
	case strings.HasPrefix(str, "[ERROR]"):
		return Error, strings.TrimSpace(str[7:])
	case strings.HasPrefix(str, "[ERR]"):
		return Error, strings.TrimSpace(str[5:])
	default:
		return Info, str
	}
}
1112017
func IsTerminal(file *os.File) bool {
	return int(C.isatty(C.int(file.Fd()))) != 0
}
603715
func (l *Logger) SetLevel(level int) {
	if l.parent != nil {
		l.parent.SetLevel(level)
		return
	}
	l.mu.Lock()
	defer l.mu.Unlock()
	if level < int(logLevelDebug) {
		level = int(logLevelDebug)
	} else if level > int(logLevelWarning) {
		level = int(logLevelWarning)
	}
	l.level = logLevel(level)
}
121027
func StdoutLoggerWithLevel(lvl string) loggerGenerator {
	l := logger.ParseLevel(lvl)
	return stdLogger(l, os.Stdout)
}
169296
func IsTerminal(fd int) bool {
	var st uint32
	r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
	return r != 0 && e == 0
}
166221
func NextSymbol(s int) int {
	if idx := SymbolIndex(s); idx != -1 {
		return Symbol[(idx+1)%len(Symbol)]
	}
	return s + 1
}
381126
func itoa(dst []byte, n int) []byte {
	var a [20]byte
	i := len(a)
	us := uintptr(n)
	for us >= 10 {
		i--
		q := us / 10
		a[i] = byte(us - q*10 + '0')
		us = q
	}
	i--
	a[i] = byte(us + '0')
	return append(dst, a[i:]...)
}
871737
func (bl *BeeLogger) Informational(format string, v ...interface{}) {
	if LevelInformational > bl.level {
		return
	}
	msg := fmt.Sprintf("[I] "+format, v...)
	bl.writerMsg(LevelInformational, msg)
}
1031677
func itob(v int) []byte {
	b := make([]byte, 8)
	binary.BigEndian.PutUint64(b, uint64(v))
	return b
}
195975
func (log Logger) intLogc(lvl level, closure func() string) {

	log.intLogNamec(logName(lvl), lvl, closure)
}
699512
func itoa(i int, wid int) string {
	// Assemble decimal in reverse order.
	var b [20]byte
	bp := len(b) - 1
	for i >= 10 || wid > 1 {
		wid--
		q := i / 10
		b[bp] = byte('0' + i - q*10)
		bp--
		i = q
	}
	// i < 10
	b[bp] = byte('0' + i)
	return string(b[bp:])
}
677272
func LogLevel() string {
	envLevel := os.Getenv(EnvLog)
	if envLevel == "" {
		return ""
	}

	logLevel := "TRACE"
	if isValidLogLevel(envLevel) {
		// allow following for better ux: info, Info or INFO
		logLevel = strings.ToUpper(envLevel)
	} else {
		log.Printf("[WARN] Invalid log level: %q. Defaulting to level: TRACE. Valid levels are: %+v",
			envLevel, ValidLevels)
	}

	return logLevel
}
1315419
func Itoas(nums ...int) []string {
	r := []string{}
	for _, n := range nums {
		r = append(r, fmt.Sprintf("%d", n))
	}
	return r
}
215549
func (p *parser) readInternal() *token {
	for t := range p.tokens {
		return &t
	}
	return &token{tokenEOF, "", -1}
}