Пример #1
0
func init() {
	config = settings.GetConfig()

	var errwriter io.Writer
	var infowriter io.Writer

	if config.ErrorLog != "" {
		var err error
		errwriter, err = os.OpenFile(config.ErrorLog, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
		if err != nil {
			log.Fatalln(err)
		}
	} else {
		errwriter = os.Stderr
	}

	if config.DebugLog != "" {
		var err error
		infowriter, err = os.OpenFile(config.DebugLog, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
		if err != nil {
			log.Fatalln(err)
		}
	} else {
		infowriter = os.Stdout
	}

	// TODO Find a way to remove the brackets around all the data?
	errors = log.New(errwriter, "", log.LstdFlags)
	info = log.New(infowriter, "", log.LstdFlags)
}
func (f *fixture) StartDB() error {
	var err error
	f.client, err = NewDB(settings.GetConfig())
	if err != nil {
		return errors.Wrap(err, "NewDB")
	}

	return nil
}
func init() {
	config = settings.GetConfig()

	var err error
	dbClient, err = db.NewDB(config)
	if err != nil {
		log.Fatalln(err)
	}
}
Пример #4
0
func init() {
	config = settings.GetConfig()
}