当前位置: 首页>>代码示例>>Golang>>正文


Golang tracelog.Completed函数代码示例

本文整理汇总了Golang中github.com/goinggo/tracelog.Completed函数的典型用法代码示例。如果您正苦于以下问题:Golang Completed函数的具体用法?Golang Completed怎么用?Golang Completed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Completed函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: main

func main() {
	tracelog.Start(tracelog.LevelTrace)

	// Init mongo
	tracelog.Started("main", "Initializing Mongo")
	err := mongo.Startup(helper.MainGoRoutine)
	if err != nil {
		tracelog.CompletedError(err, helper.MainGoRoutine, "initApp")
		os.Exit(1)
	}

	// Load message strings
	localize.Init("en-US")

	SessionConfig, err := session.GetSessionConfig("session")

	tracelog.Trace("main", "SessionConfig", "Session : On[%v]", SessionConfig.On)
	tracelog.Trace("main", "SessionConfig", "Session : On[%v]", SessionConfig.Provider)
	tracelog.Trace("main", "SessionConfig", "Session : On[%v]", SessionConfig.SavePath)

	beego.SessionOn = SessionConfig.On
	beego.SessionProvider = SessionConfig.Provider
	beego.SessionSavePath = SessionConfig.SavePath

	beego.Run()

	tracelog.Completed(helper.MainGoRoutine, "Website Shutdown")
	tracelog.Stop()
}
开发者ID:blackcs,项目名称:ConsoleWindowApp,代码行数:29,代码来源:main.go

示例2: CloseSession

// CloseSession puts the connection back into the pool
func CloseSession(sessionId string, mongoSession *mgo.Session) {
	defer helper.CatchPanic(nil, sessionId, "CloseSession")

	tracelog.Started(sessionId, "CloseSession")
	mongoSession.Close()
	tracelog.Completed(sessionId, "CloseSession")
}
开发者ID:jharlap,项目名称:beego-mgo,代码行数:8,代码来源:mongo.go

示例3: FindStation

// FindStation retrieves the specified station
func FindStation(service *services.Service, stationId string) (buoyStation *buoyModels.BuoyStation, err error) {
	defer helper.CatchPanic(&err, service.UserId, "FindStation")

	tracelog.Started(service.UserId, "FindStation")

	queryMap := bson.M{"station_id": stationId}

	buoyStation = &buoyModels.BuoyStation{}
	err = service.DBAction(Config.Database, "buoy_stations",
		func(collection *mgo.Collection) error {
			tracelog.Trace(service.UserId, "FindStation", "Query : %s", mongo.ToString(queryMap))
			return collection.Find(queryMap).One(buoyStation)
		})

	if err != nil {
		if strings.Contains(err.Error(), "not found") == false {
			tracelog.CompletedError(err, service.UserId, "FindStation")
			return buoyStation, err
		}

		err = nil
	}

	tracelog.Completed(service.UserId, "FindStation")
	return buoyStation, err
}
开发者ID:jharlap,项目名称:beego-mgo,代码行数:27,代码来源:buoyService.go

示例4: Startup

// Startup brings the manager to a running state.
func Startup(sessionID string) error {
	// If the system has already been started ignore the call.
	if singleton.sessions != nil {
		return nil
	}

	log.Started(sessionID, "Startup")

	// Pull in the configuration.
	var config mongoConfiguration
	if err := envconfig.Process("mgo", &config); err != nil {
		log.CompletedError(err, sessionID, "Startup")
		return err
	}

	// Create the Mongo Manager.
	singleton = mongoManager{
		sessions: make(map[string]mongoSession),
	}

	// Create the strong session.
	if err := CreateSession(sessionID, "strong", MasterSession, config.Url); err != nil {
		log.CompletedError(err, sessionID, "Startup")
		return err
	}

	// Create the monotonic session.
	if err := CreateSession(sessionID, "monotonic", MonotonicSession, config.Url); err != nil {
		log.CompletedError(err, sessionID, "Startup")
		return err
	}

	log.Completed(sessionID, "Startup")
	return nil
}
开发者ID:liuhong1happy,项目名称:ConsoleWindowApp,代码行数:36,代码来源:mongo.go

示例5: Shutdown

// Shutdown systematically brings the manager down gracefully.
func Shutdown(sessionID string) error {
	log.Started(sessionID, "Shutdown")

	// Close the databases
	for _, session := range singleton.sessions {
		CloseSession(sessionID, session.mongoSession)
	}

	log.Completed(sessionID, "Shutdown")
	return nil
}
开发者ID:phillihq,项目名称:beelike,代码行数:12,代码来源:mongo.go

示例6: Shutdown

// Shutdown systematically brings the manager down gracefully
func Shutdown(sessionId string) (err error) {
	defer helper.CatchPanic(&err, sessionId, "Shutdown")

	tracelog.Started(sessionId, "Shutdown")

	// Close the databases
	for _, session := range singleton.sessions {
		CloseSession(sessionId, session.mongoSession)
	}

	tracelog.Completed(sessionId, "Shutdown")
	return err
}
开发者ID:jharlap,项目名称:beego-mgo,代码行数:14,代码来源:mongo.go

示例7: CreateSession

// CreateSession creates a connection pool for use
func CreateSession(sessionId string, mode string, sessionName string, hosts []string, databaseName string, username string, password string) (err error) {
	defer helper.CatchPanic(nil, sessionId, "CreateSession")

	tracelog.Startedf(sessionId, "CreateSession", "Mode[%s] SessionName[%s] Hosts[%s] DatabaseName[%s] Username[%s]", mode, sessionName, hosts, databaseName, username)

	// Create the database object
	mongoSession := &mongoSession{
		mongoDBDialInfo: &mgo.DialInfo{
			Addrs:    hosts,
			Timeout:  60 * time.Second,
			Database: databaseName,
			Username: username,
			Password: password,
		},
	}

	// Establish the master session
	mongoSession.mongoSession, err = mgo.DialWithInfo(mongoSession.mongoDBDialInfo)
	if err != nil {
		tracelog.CompletedError(err, sessionId, "CreateSession")
		return err
	}

	switch mode {
	case "strong":
		// Reads and writes will always be made to the master server using a
		// unique connection so that reads and writes are fully consistent,
		// ordered, and observing the most up-to-date data.
		// http://godoc.org/labix.org/v2/mgo#Session.SetMode
		mongoSession.mongoSession.SetMode(mgo.Strong, true)
		break

	case "monotonic":
		// Reads may not be entirely up-to-date, but they will always see the
		// history of changes moving forward, the data read will be consistent
		// across sequential queries in the same session, and modifications made
		// within the session will be observed in following queries (read-your-writes).
		// http://godoc.org/labix.org/v2/mgo#Session.SetMode
		mongoSession.mongoSession.SetMode(mgo.Monotonic, true)
	}

	// Have the session check for errors
	// http://godoc.org/labix.org/v2/mgo#Session.SetSafe
	mongoSession.mongoSession.SetSafe(&mgo.Safe{})

	// Add the database to the map
	singleton.sessions[sessionName] = mongoSession

	tracelog.Completed(sessionId, "CreateSession")
	return err
}
开发者ID:jharlap,项目名称:beego-mgo,代码行数:52,代码来源:mongo.go

示例8: main

func main() {

	tracelog.Start(tracelog.LevelTrace)
	err := mongo.Startup(helper.MainGoRoutine)
	if err != nil {
		tracelog.CompletedError(err, helper.MainGoRoutine, "initApp")
		os.Exit(1)
	} else {
		fmt.Println("mongodb启动正常")
	}
	beego.Run()

	tracelog.Completed(helper.MainGoRoutine, "Website Shutdown")
	tracelog.Stop()
}
开发者ID:phillihq,项目名称:beelike,代码行数:15,代码来源:main.go

示例9: CloneSession

// CloneSession makes a clone of the specified session for client use.
func CloneSession(sessionID string, useSession string) (*mgo.Session, error) {
	log.Startedf(sessionID, "CloneSession", "UseSession[%s]", useSession)

	// Find the session object.
	session := singleton.sessions[useSession]

	if session.mongoSession == nil {
		err := fmt.Errorf("Unable To Locate Session %s", useSession)
		log.CompletedError(err, sessionID, "CloneSession")
		return nil, err
	}

	// Clone the master session.
	mongoSession := session.mongoSession.Clone()

	log.Completed(sessionID, "CloneSession")
	return mongoSession, nil
}
开发者ID:phillihq,项目名称:beelike,代码行数:19,代码来源:mongo.go

示例10: main

func main() {
	tracelog.Start(tracelog.LevelTrace)

	// Init mongo
	tracelog.Started("main", "Initializing Mongo")
	err := mongo.Startup(helper.MainGoRoutine)
	if err != nil {
		tracelog.CompletedError(err, helper.MainGoRoutine, "initApp")
		os.Exit(1)
	}

	// Load message strings
	localize.Init("en-US")

	beego.Run()

	tracelog.Completed(helper.MainGoRoutine, "Website Shutdown")
	tracelog.Stop()
}
开发者ID:ZloiBubr,项目名称:beego-mgo,代码行数:19,代码来源:main.go

示例11: main

func main() {
	tracelog.Start(tracelog.LEVEL_TRACE)

	// Init mongo
	tracelog.Started("main", "Initializing Mongo")
	err := mongo.Startup(helper.MAIN_GO_ROUTINE)
	if err != nil {
		tracelog.CompletedError(err, helper.MAIN_GO_ROUTINE, "initApp")
		os.Exit(1)
	}

	// Load message strings
	localize.Init("en-US")

	beego.Run()

	tracelog.Completed(helper.MAIN_GO_ROUTINE, "Website Shutdown")
	tracelog.Stop()
}
开发者ID:jharlap,项目名称:beego-mgo,代码行数:19,代码来源:main.go

示例12: Init

// Init initializes the local environment
func Init(defaultLocale string) error {
	tracelog.Startedf("localize", "Init", "defaultLocal[%s]", defaultLocale)

	switch defaultLocale {
	case "en-US":
		LoadJSON(defaultLocale, EnUS)
	default:
		return fmt.Errorf("Unsupported Locale: %s", defaultLocale)
	}

	// Obtain the default translation function for use
	var err error
	if T, err = NewTranslation(defaultLocale, defaultLocale); err != nil {
		return err
	}

	tracelog.Completed("localize", "Init")
	return nil
}
开发者ID:ZloiBubr,项目名称:beego-mgo,代码行数:20,代码来源:messages.go

示例13: Startup

// Startup brings the manager to a running state.
func Startup(sessionID string) error {
	// If the system has already been started ignore the call.
	if singleton.sessions != nil {
		return nil
	}

	log.Started(sessionID, "Startup")

	// Pull in the configuration.
	var config mongoConfiguration
	if err := envconfig.Process("mgo", &config); err != nil {
		log.CompletedError(err, sessionID, "Startup")
		return err
	}

	// Create the Mongo Manager.
	singleton = mongoManager{
		sessions: make(map[string]mongoSession),
	}

	// Log the mongodb connection straps.
	log.Trace(sessionID, "Startup", "MongoDB : Hosts[%s]", config.Hosts)
	log.Trace(sessionID, "Startup", "MongoDB : Database[%s]", config.Database)
	log.Trace(sessionID, "Startup", "MongoDB : Username[%s]", config.UserName)

	hosts := strings.Split(config.Hosts, ",")

	// Create the strong session.
	if err := CreateSession(sessionID, "strong", MasterSession, hosts, config.Database, config.UserName, config.Password); err != nil {
		log.CompletedError(err, sessionID, "Startup")
		return err
	}

	// Create the monotonic session.
	if err := CreateSession(sessionID, "monotonic", MonotonicSession, hosts, config.Database, config.UserName, config.Password); err != nil {
		log.CompletedError(err, sessionID, "Startup")
		return err
	}

	log.Completed(sessionID, "Startup")
	return nil
}
开发者ID:ZloiBubr,项目名称:beego-mgo,代码行数:43,代码来源:mongo.go

示例14: CreateSession

// CreateSession creates a connection pool for use.
func CreateSession(sessionID string, mode string, sessionName string, url string) error {
	log.Startedf(sessionID, "CreateSession", "Mode[%s] Url[%s]", mode, sessionName, url)

	// Create the database object
	mongoSession := mongoSession{}

	// Establish the master session.
	var err error
	mongoSession.mongoSession, err = mgo.Dial(url)
	if err != nil {
		log.CompletedError(err, sessionID, "CreateSession")
		return err
	}

	switch mode {
	case "strong":
		// Reads and writes will always be made to the master server using a
		// unique connection so that reads and writes are fully consistent,
		// ordered, and observing the most up-to-date data.
		// http://godoc.org/github.com/finapps/mgo#Session.SetMode
		mongoSession.mongoSession.SetMode(mgo.Strong, true)
		break

	case "monotonic":
		// Reads may not be entirely up-to-date, but they will always see the
		// history of changes moving forward, the data read will be consistent
		// across sequential queries in the same session, and modifications made
		// within the session will be observed in following queries (read-your-writes).
		// http://godoc.org/github.com/finapps/mgo#Session.SetMode
		mongoSession.mongoSession.SetMode(mgo.Monotonic, true)
	}

	// Have the session check for errors.
	// http://godoc.org/github.com/finapps/mgo#Session.SetSafe
	mongoSession.mongoSession.SetSafe(&mgo.Safe{})

	// Add the database to the map.
	singleton.sessions[sessionName] = mongoSession

	log.Completed(sessionID, "CreateSession")
	return nil
}
开发者ID:liuhong1happy,项目名称:ConsoleWindowApp,代码行数:43,代码来源:mongo.go

示例15: CloneSession

// CopySession makes a clone of the specified session for client use
func CloneSession(sessionId string, useSession string) (mongoSession *mgo.Session, err error) {
	defer helper.CatchPanic(nil, sessionId, "CopySession")

	tracelog.Startedf(sessionId, "CloneSession", "UseSession[%s]", useSession)

	// Find the session object
	session := singleton.sessions[useSession]

	if session == nil {
		err = fmt.Errorf("Unable To Locate Session %s", useSession)
		tracelog.CompletedError(err, sessionId, "CloneSession")
		return mongoSession, err
	}

	// Clone the master session
	mongoSession = session.mongoSession.Clone()

	tracelog.Completed(sessionId, "CloneSession")
	return mongoSession, err
}
开发者ID:jharlap,项目名称:beego-mgo,代码行数:21,代码来源:mongo.go


注:本文中的github.com/goinggo/tracelog.Completed函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。