示例#1
0
文件: mtail.go 项目: hanscj1/mtail
// New creates an Mtail from the supplied Options.
func New(o Options) (*Mtail, error) {
	m := &Mtail{
		lines:   make(chan string),
		webquit: make(chan struct{}),
		o:       o}

	err := m.InitLoader()
	if err != nil {
		return nil, err
	}

	m.e, err = exporter.New(exporter.Options{Store: &m.store})
	if err != nil {
		return nil, err
	}

	return m, nil
}
示例#2
0
// New creates an Mtail from the supplied Options.
func New(o Options) (*Mtail, error) {
	store := o.Store
	if store == nil {
		store = metrics.NewStore()
	}
	m := &Mtail{
		lines:   make(chan string),
		store:   store,
		webquit: make(chan struct{}),
		o:       o}

	err := m.InitLoader()
	if err != nil {
		return nil, err
	}

	m.e, err = exporter.New(exporter.Options{Store: m.store})
	if err != nil {
		return nil, err
	}

	return m, nil
}