// NewStdlibAdapter returns a new StdlibAdapter wrapper around the passed
// logger. It's designed to be passed to log.SetOutput.
328565
func NewStdlibAdapter(logger Logger, options ...StdlibAdapterOption) io.Writer {
	a := StdlibAdapter{
		Logger:       logger,
		timestampKey: "ts",
		fileKey:      "caller",
		messageKey:   "msg",
	}
	for _, option := range options {
		option(&a)
	}
	return a
}
577971
func NewSetAdBlockingEnabledArgs(enabled bool) *SetAdBlockingEnabledArgs {
	args := new(SetAdBlockingEnabledArgs)
	args.Enabled = enabled
	return args
}
251527
func StreamDebugLog(source base.StreamConnector, args DebugLogParams) (<-chan LogMessage, error) {
	// TODO(babbageclunk): this isn't cancellable - if the caller stops
	// reading from the channel (because it has an error, for example),
	// the goroutine will be leaked. This is OK when used from the command
	// line, but is a problem if it happens in jujud. Change it to accept
	// a stop channel and use a read deadline so that the client can stop
	// it. https://pad.lv/1644084

	// Prepare URL query attributes.
	attrs := args.URLQuery()

	connection, err := source.ConnectStream("/log", attrs)
	if err != nil {
		return nil, errors.Trace(err)
	}

	messages := make(chan LogMessage)
	go func() {
		defer close(messages)

		for {
			var msg params.LogMessage
			err := connection.ReadJSON(&msg)
			if err != nil {
				return
			}
			messages <- LogMessage{
				Entity:    msg.Entity,
				Timestamp: msg.Timestamp,
				Severity:  msg.Severity,
				Module:    msg.Module,
				Location:  msg.Location,
				Message:   msg.Message,
			}
		}
	}()

	return messages, nil
}
374908
func TeeReadCloser(rc io.ReadCloser, w io.Writer) io.ReadCloser {
	return &teeReadCloser{rc, io.TeeReader(rc, w)}
}
564220
func (v *Notebook) QueryTabLabelPacking(child IWidget, expand *bool, fill *bool, pack_type *uint) {
	deprecated_since(2, 20, 0, "gtk_notebook_query_tab_label_packing()")
	var cexpand, cfill C.gboolean
	var cpack_type C.GtkPackType
	C.gtk_notebook_query_tab_label_packing(NOTEBOOK(v), ToNative(child), &cexpand, &cfill, &cpack_type)
	*expand = gobool(cexpand)
	*fill = gobool(cfill)
	*pack_type = uint(cpack_type)
}
768345
func newStorageDBWrapper(db *mgo.Database, metaColl, modelUUID string) *storageDBWrapper {
	session := db.Session.Copy()
	db = db.With(session)

	coll := db.C(metaColl)
	txnRunner := jujutxn.NewRunner(jujutxn.RunnerParams{
		Database:               db,
		ServerSideTransactions: false,
	})
	dbWrap := storageDBWrapper{
		session:   session,
		db:        db,
		metaColl:  coll,
		txnRunner: txnRunner,
		modelUUID: modelUUID,
	}
	return &dbWrap
}
1271065
func NewStaticTargeter(tgts ...Target) Targeter {
	i := int64(-1)
	return func(tgt *Target) error {
		if tgt == nil {
			return ErrNilTarget
		}
		*tgt = tgts[atomic.AddInt64(&i, 1)%int64(len(tgts))]
		return nil
	}
}
1356309
func NewStdoutWriter(out io.Writer) io.Writer {
	return &streamWriter{Writer: out, lineFormat: func(buf []byte) string {
		return string(buf)
	}}
}
740885
func NewSourceFromDatabase(
	dbMap dbSelector,
	caKeyHash []byte,
	reqSerialPrefixes []string,
	timeout time.Duration,
	log blog.Logger,
) (src *DBSource, err error) {
	src = &DBSource{
		dbMap:             dbMap,
		caKeyHash:         caKeyHash,
		reqSerialPrefixes: reqSerialPrefixes,
		timeout:           timeout,
		log:               log,
	}
	return
}
607318
func NewSimpleLogger(w io.Writer, lvl Level, prefix string, color bool) *Logger {
	l := &Logger{}
	r := NewReceiver(w, prefix)
	r.Color = color
	r.Level = lvl
	l.Receivers = []*Receiver{r}
	l.Active = true
	return l
}
179394
func newStdoutPrinter(forMachines bool) tablePrinter {
	if forMachines {
		return newMachineReadable(os.Stdout)
	}
	return newHumanReadable(os.Stdout)
}
1359685
func NewStmtList(Stmts []node.Node) *StmtList {
	return &StmtList{
		FreeFloating: nil,
		Stmts:        Stmts,
	}
}
179280
func NewStdLogger() log.Logger {
	return log.LoggerFunc(func(format string, args ...interface{}) {
		glog.V(2).Infof(format, args...)
	})
}
715221
func NewStatter(statsdURL, statsPrefix string) (*LoggingStatter, error) {
	stats, err := statsd.NewClient(statsdURL, statsPrefix)
	if err != nil {
		return nil, err
	}
	return &LoggingStatter{Statter: stats}, nil
}
957589
func NewSeriesQueryAdapterIterator(sfile *SeriesFile, itr SeriesIDIterator, opt query.IteratorOptions) query.Iterator {
	return &seriesQueryAdapterIterator{
		sfile: sfile,
		itr:   itr,
		point: query.FloatPoint{
			Aux: make([]interface{}, len(opt.Aux)),
		},
		opt: opt,
	}
}
471155
func NewSystemdLogger(name string, l LevelInfo) (Sender, error) {
	s, err := MakeSystemdLogger()
	if err != nil {
		return nil, err
	}

	return setup(s, name, l)
}
1230264
func NewStorageAdapter(bufferSize int) (*adapter, error) {
	if bufferSize <= 0 {
		return nil, fmt.Errorf("Invalid ringBuffer size: %d", bufferSize)
	}
	return &adapter{bufferSize: bufferSize, ringBuffers: make(map[string]*ringBuffer)}, nil
}