// NewDefaultLogBuffer creates a new LogBuffer of the given buffer size, that captures the logs
// of the default logger of the"github.com/sirupsen/logrus" package, and of the golib package.
347926
func NewDefaultLogBuffer(message_buffer int) *LogBuffer {
	return NewLogBuffer(message_buffer, []*log.Logger{log.StandardLogger(), golib.Log})
}
566269
func NewFileLog(cfg FileLogConfig) (*FileLog, error) {
	if err := cfg.CheckAndSetDefaults(); err != nil {
		return nil, trace.Wrap(err)
	}
	f := &FileLog{
		FileLogConfig: cfg,
		Entry: log.WithFields(log.Fields{
			trace.Component: teleport.ComponentAuditLog,
		}),
	}
	return f, nil
}
23483
func NewLogger() dlog.Logger {
	return dlog.NewLogger(
		glog.Infoln,
		map[dlog.Level]func(...interface{}){
			dlog.LevelDebug: glog.Infoln,
			dlog.LevelInfo:  glog.Infoln,
			dlog.LevelWarn:  glog.Warningln,
			dlog.LevelError: glog.Errorln,
			// this relies on implementation-specific details of the generic dlog Logger implementation, not good
			dlog.LevelFatal: glog.Fatalln,
			dlog.LevelPanic: glog.Errorln,
		},
	)
}
1290521
func NewLogWriter(buf int) *LogWriter {
	return &LogWriter{
		logs:     make([]string, buf),
		index:    0,
		handlers: make(map[LogHandler]struct{}),
	}
}
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,
	}
}
58273
func NewLogger(p Priority, logFlag int) (*log.Logger, error) {
	s, err := New(p, "")
	if err != nil {
		return nil, err
	}
	return log.New(s, "", logFlag), nil
}
1174990
func New() *Logger {
	defaultOutputMutex.RLock()
	defer defaultOutputMutex.RUnlock()

	logger := &Logger{
		Fields:  make(map[string]interface{}),
		outputs: make([]*loggerOutputWrapper, len(defaultOutputs)),
	}
	copy(logger.outputs, defaultOutputs)

	return logger
}
210263
func NewFormatLogWriter(out io.Writer, format string) FormatLogWriter {
	records := make(FormatLogWriter, LogBufferLength)
	go records.run(out, format)
	return records
}
667136
func createLoggerEventToBufferFunction(output *bytes.Buffer) func(*logutilpb.Event) {
	return func(e *logutilpb.Event) {
		logutil.EventToBuffer(e, output)
		output.WriteRune('\n')
	}
}
448096
func NewLog(uri, b64PK string, logger blog.Logger) (*Log, error) {
	url, err := url.Parse(uri)
	if err != nil {
		return nil, err
	}
	url.Path = strings.TrimSuffix(url.Path, "/")

	pemPK := fmt.Sprintf("-----BEGIN PUBLIC KEY-----\n%s\n-----END PUBLIC KEY-----",
		b64PK)
	opts := jsonclient.Options{
		Logger:    logAdaptor{logger},
		PublicKey: pemPK,
	}
	httpClient := &http.Client{
		// We set the HTTP client timeout to about half of what we expect
		// the gRPC timeout to be set to. This allows us to retry the
		// request at least twice in the case where the server we are
		// talking to is simply hanging indefinitely.
		Timeout: time.Minute*2 + time.Second*30,
		// We provide a new Transport for each Client so that different logs don't
		// share a connection pool. This shouldn't matter, but we occasionally see a
		// strange bug where submission to all logs hangs for about fifteen minutes.
		// One possibility is that there is a strange bug in the locking on
		// connection pools (possibly triggered by timed-out TCP connections). If
		// that's the case, separate connection pools should prevent cross-log impact.
		// We set some fields like TLSHandshakeTimeout to the values from
		// DefaultTransport because the zero value for these fields means
		// "unlimited," which would be bad.
		Transport: &http.Transport{
			MaxIdleConns:        http.DefaultTransport.(*http.Transport).MaxIdleConns,
			IdleConnTimeout:     http.DefaultTransport.(*http.Transport).IdleConnTimeout,
			TLSHandshakeTimeout: http.DefaultTransport.(*http.Transport).TLSHandshakeTimeout,
		},
	}
	client, err := ctClient.New(url.String(), httpClient, opts)
	if err != nil {
		return nil, fmt.Errorf("making CT client: %s", err)
	}

	// TODO: Maybe this isn't necessary any more now that ctClient can check sigs?
	pkBytes, err := base64.StdEncoding.DecodeString(b64PK)
	if err != nil {
		return nil, fmt.Errorf("Failed to decode base64 log public key")
	}
	pk, err := x509.ParsePKIXPublicKey(pkBytes)
	if err != nil {
		return nil, fmt.Errorf("Failed to parse log public key")
	}

	verifier, err := ct.NewSignatureVerifier(pk)
	if err != nil {
		return nil, err
	}

	return &Log{
		logID:    b64PK,
		uri:      url.String(),
		client:   client,
		verifier: verifier,
	}, nil
}
411389
func InitializeDefaultLogger() *logrus.Logger {
	logger := logrus.New()
	logger.Formatter = setupFormatter()
	return logger
}
68484
func NewVaultLogger(level log.Level) log.Logger {
	return NewVaultLoggerWithWriter(log.DefaultOutput, level)
}
718094
func InstallBufferedLogWriter(maxLen int) (*BufferedLogWriter, error) {
	writer := NewBufferedLogWriter(maxLen)
	err := loggo.RegisterWriter(writerName, writer)
	if err != nil {
		return nil, errors.Annotate(err, "failed to set up log buffering")
	}
	return writer, nil
}
529295
func newBuffer(nc net.Conn) buffer {
	fg := make([]byte, defaultBufSize)
	return buffer{
		buf:  fg,
		nc:   nc,
		dbuf: [2][]byte{fg, nil},
	}
}
623277
func NewDefaultLlvBarsForStreamWithSrcLen(sourceLength uint, priceStream gotrade.DOHLCVStreamSubscriber) (indicator *LlvBars, err error) {
	ind, err := NewDefaultLlvBarsWithSrcLen(sourceLength)
	priceStream.AddTickSubscription(ind)
	return ind, err
}
496216
func NewLog(level string) (*log.Logger, error) {

	lvl, err := colog.ParseLevel(level)
	if err != nil {
		return nil, err
	}

	cl := colog.NewCoLog(os.Stderr, "", log.Lshortfile|log.Ldate|log.Ltime)
	cl.SetMinLevel(lvl)
	cl.SetDefaultLevel(lvl)
	lg := cl.NewLogger()
	return lg, nil
}
643356
func NewDefaultHandler() *defaultHandler {
	h := &defaultHandler{
		objects:     make(map[ObjectPath]*exportedObj),
		defaultIntf: make(map[string]*exportedIntf),
	}
	h.defaultIntf["org.freedesktop.DBus.Introspectable"] = newIntrospectIntf(h)
	return h
}