// NewParentLogger creates new parent logger with given LoggerFactory and name as prefix.
193983
func NewParentLogger(name string, factory LoggerFactory) *ParentLogger {
	return &ParentLogger{
		Logger:  factory.NewLogger(name),
		Prefix:  name,
		Factory: factory,
	}
}
500724
func (lr *logRegistry) NewLogger(name string) logging.Logger {
	if existingLogger := lr.getLoggerFromMapping(name); existingLogger != nil {
		panic(fmt.Errorf("logger with name '%s' already exists", name))
	}
	if err := checkLoggerName(name); err != nil {
		panic(err)
	}

	logger := NewLogger(name)

	// set initial logger level
	if lvl, ok := lr.logLevels[name]; ok {
		setLevel(logger, lvl)
	} else {
		setLevel(logger, lr.defaultLevel)
	}

	lr.putLoggerToMapping(logger)

	// add all defined hooks
	for _, hook := range lr.hooks {
		logger.std.AddHook(hook)
	}

	return logger
}
756057
func NewBaseHandler(name string, level LogLevelType) *BaseHandler {
	return &BaseHandler{
		StandardFilterer: NewStandardFilterer(),
		name:             name,
		level:            level,
		formatter:        nil,
	}
}
193439
func NewChannelLogger(size int) *ChannelLogger {
	c := make(chan *logutilpb.Event, size)
	return &ChannelLogger{
		CallbackLogger: CallbackLogger{
			f: func(e *logutilpb.Event) {
				c <- e
			},
		},
		C: c,
	}
}
943567
func NewLogger(sink io.Writer, options ...Option) *Logger {
	if sink == nil {
		sink = ioutil.Discard
	}

	l := &Logger{
		sink:     sink,
		throttle: DefaultLoggingThrottle,
		widthFn: func() int {
			size, err := ts.GetSize()
			if err != nil {
				return 80
			}
			return size.Col()
		},
		queue: make(chan Task),
		tasks: make(chan Task),
		wg:    new(sync.WaitGroup),
	}

	for _, option := range options {
		option(l)
	}

	l.tty = tty(sink)

	go l.consume()

	return l
}
94684
func NewLogger(outputLogger log.Logger) *Logger {
	// We will never halt the progress of a log emitter. If log output takes too
	// long will start dropping log lines by using a ring buffer.
	swapLogger := new(log.SwapLogger)
	swapLogger.Swap(outputLogger)
	return &Logger{
		Output: swapLogger,
		// logging contexts
		Info: log.With(swapLogger,
			structure.ChannelKey, structure.InfoChannelName,
		),
		Trace: log.With(swapLogger,
			structure.ChannelKey, structure.TraceChannelName,
		),
	}
}
241799
func NewNativeLogger(name string, l LevelInfo) (Sender, error) {
	return setup(MakeNative(), name, l)
}
1193746
func NewLogger(w io.Writer) Logger {
	l := logrus.New()
	l.Out = w
	return logger{entry: logrus.NewEntry(l)}
}
729295
func NewLogger() *Logger {
	l := &Logger{}
	l.base.SetPrefix("")
	l.base.SetFlags(log.Lmicroseconds | log.Lshortfile)
	l.SetLevel(LDebug, LInfo, LWarn, LError, LFatal)
	l.SetWriter(os.Stderr)
	return l
}
856883
func NewContextLogger(ctx context.Context, logger log.Logger) context.Context {
	return context.WithValue(ctx, ctxKeyLogger, logger)
}
235152
func NewHookLogger(logger loggo.Logger, outReader io.ReadCloser) *HookLogger {
	return &HookLogger{
		r:      outReader,
		done:   make(chan struct{}),
		logger: logger,
	}
}
493140
func NewJSONLogger(w io.Writer, ErrHandler ErrorHandler) Logger {
	if w == ioutil.Discard {
		return Discard
	}
	return &ErrorLogLogger{
		RootLogger: &JSONLogger{
			Out:             w,
			MissingValueKey: Msg,
		},
		ErrHandler: ErrHandler,
	}
}
1322625
func NewLogHandler(xp rpc.Transporter, logReg *logRegister, g *libkb.GlobalContext) *LogHandler {
	return &LogHandler{
		BaseHandler:  NewBaseHandler(g, xp),
		logReg:       logReg,
		Contextified: libkb.NewContextified(g),
	}
}
567459
func New(out io.Writer, prefix string, debug bool) *Logger {
	l := &Logger{
		debug:  debug,
		Logger: log.New(out, prefix, 0),
	}
	l.SetFlags(0)
	return l
}
162902
func newLogger(keep time.Duration) *logger {
	return &logger{
		events: make(map[uint64]logEvent),
		keep:   keep,
	}
}
1065150
func NewFileLogger(name, filePath string, l LevelInfo) (Sender, error) {
	s, err := MakeFileLogger(filePath)
	if err != nil {
		return nil, err
	}

	return setup(s, name, l)
}
779618
func New(name string) Logger {
	l := Logger(&logger{
		level:       levels.DEBUG,
		name:        name,
		enabled:     make(map[levels.LogLevel]bool),
		appender:    appenders.Console(),
		children:    make([]Logger, 0),
		parent:      nil,
		ExitOnFatal: true,
	})
	l.SetLevel(levels.DEBUG)
	return l
}