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


Golang monolog.Info函数代码示例

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


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

示例1: LoadRoom

// Load a room from a sitef file.
func LoadRoom(dirname string, id string) (room *Room, err error) {

	path := SavePathFor(dirname, "room", id)

	records, err := sitef.ParseFilename(path)
	if err != nil {
		return nil, err
	}

	if len(records) < 1 {
		return nil, errors.New("No room found!")
	}

	record := records[0]
	monolog.Info("Loading Room record: %s %v", path, record)

	room = new(Room)
	room.Entity.LoadSitef(*record)
	/*
	   account.Name            = record.Get("name")
	   account.Hash            = record.Get("hash")
	   account.Algo            = record.Get("algo")
	   account.Email           = record.Get("email")
	   account.Points          = record.GetIntDefault("points", 0)
	   account.Privilege       = Privilege(record.GetIntDefault("privilege",
	                               int(PRIVILEGE_NORMAL)))

	   var nchars int
	   nchars                  = record.GetIntDefault("characters", 0)
	   _ = nchars
	*/
	monolog.Info("Loaded Room: %s %v", path, room)
	return room, nil
}
开发者ID:beoran,项目名称:woe,代码行数:35,代码来源:room.go

示例2: SetupNegotiate

func (me *Client) SetupNegotiate(millis int, command byte, option byte, yes_event telnet.EventType, no_event telnet.EventType) (bool, telnet.Event) {
	me.telnet.TelnetSendNegotiate(command, option)
	tev, timeout, close := me.TryReadEvent(millis)

	if tev == nil || timeout || close {
		monolog.Info("Timeout or close in TryReadEvent")
		return false, nil
	}

	evtype := telnet.EventTypeOf(tev)

	if evtype == no_event {
		monolog.Info("Negative event no_event %v %v %v", tev, evtype, no_event)
		return false, tev
	}

	if evtype != yes_event {
		monolog.Info("Unexpected event yes_event %v %v %v", tev, evtype, yes_event)
		return false, tev
	}

	if tev == nil {
		return false, tev
	}

	return true, tev
}
开发者ID:beoran,项目名称:woe,代码行数:27,代码来源:setuptelnet.go

示例3: runSupervisor

func runSupervisor() (status int) {
	monolog.Setup("woe.log", true, false)
	defer monolog.Close()
	enableDisableLogs()
	monolog.Info("Starting WOE supervisor.")
	for server_restart {
		// wd  , _ := os.Getwd()
		exe := fmt.Sprintf("%s", os.Args[0])
		argp := fmt.Sprintf("-l=%s", *server_tcpip)
		argel := fmt.Sprintf("-el=%s", *enable_logs)
		argdl := fmt.Sprintf("-dl=%s", *disable_logs)
		cmd := exec.Command(exe, "-s=true", argp, argel, argdl)
		monolog.Info("Starting server %s at %s.", exe, *server_tcpip)
		cmd.Stderr = os.Stderr
		cmd.Stdout = os.Stdout
		monolog.Debug("Server command line: %s.", cmd.Args)
		err := cmd.Run()
		monolog.Info("Server at %s shut down.", *server_tcpip)
		if err != nil {
			monolog.Error("Server shut down with error %s!", err)
			server_restart = false
			return 1
		}
	}
	return 0
}
开发者ID:beoran,项目名称:woe,代码行数:26,代码来源:woe.go

示例4: Init

func (me *Being) Init(kind string, name string, privilege Privilege,
	kin Entitylike, gender Entitylike, job Entitylike) *Being {
	if me == nil {
		return me
	}
	me.Entity.InitKind(kind, name, privilege)

	realkin := EntitylikeToKin(kin)
	realgen := EntitylikeToGender(gender)
	realjob := EntitylikeToJob(job)

	monolog.Info("Init being: Kin: %v", realkin)
	monolog.Info("Init being: Gender: %v", realgen)
	monolog.Info("Init being: Job: %v", realjob)

	me.Kin = realkin
	me.Gender = realgen
	me.Job = realjob

	me.Talents.GrowFrom(BasicTalent)
	me.Talents.GrowFrom(me.Kin.Talents)
	me.Talents.GrowFrom(me.Gender.Talents)
	me.Talents.GrowFrom(me.Job.Talents)

	me.Level = 1
	me.RecalculateVitals()

	return me
}
开发者ID:beoran,项目名称:woe,代码行数:29,代码来源:being.go

示例5: onConnect

func (me *Server) onConnect(conn net.Conn) (err error) {
	id, err := me.findFreeID()
	if err != nil {
		monolog.Info("Refusing connection for %s: too many clients. ", conn.RemoteAddr().String())
		conn.Close()
		return nil
	}
	monolog.Info("New client connected from %s, id %d. ", conn.RemoteAddr().String(), id)
	client := NewClient(me, id, conn)
	me.clients[id] = client
	return client.Serve()
}
开发者ID:beoran,项目名称:woe,代码行数:12,代码来源:server.go

示例6: GetStruct

func (me Record) GetStruct(prefix string, structure interface{}) {
	monolog.Info("GetStruct: structure %v, %v\n", structure,
		reflect.TypeOf(structure))

	st := reflect.TypeOf(structure).Elem()
	vt := reflect.Indirect(reflect.ValueOf(structure))
	monolog.Info("GetStruct: type %v value %v\n", st, vt)

	for i := 0; i < st.NumField(); i++ {
		field := st.Field(i)
		key := prefix + strings.ToLower(field.Name)
		value := reflect.Indirect(vt).Field(i)
		me.GetValue(key, value)
	}
}
开发者ID:beoran,项目名称:woe,代码行数:15,代码来源:sitef.go

示例7: TryLexing

func (me *Lexer) TryLexing() {
	go me.Start()

	for token := range me.Output {
		monolog.Info("Token %s", token)
	}
}
开发者ID:beoran,项目名称:woe,代码行数:7,代码来源:raku.go

示例8: LoadAccount

// Load an account from a sitef file.
func LoadAccount(dirname string, name string) (account *Account, err error) {

	path := SavePathFor(dirname, "account", name)

	records, err := sitef.ParseFilename(path)
	if err != nil {
		return nil, err
	}

	if len(records) < 1 {
		return nil, errors.New("No record found!")
	}

	record := records[0]
	monolog.Info("Loading Account record: %s %v", path, record)

	account = new(Account)
	account.Name = record.Get("name")
	account.Hash = record.Get("hash")
	account.Algo = record.Get("algo")
	account.Email = record.Get("email")
	account.Points = record.GetIntDefault("points", 0)
	account.Privilege = Privilege(record.GetIntDefault("privilege",
		int(PRIVILEGE_NORMAL)))

	nchars := record.GetIntDefault("characters", 0)
	account.characters = make([]*Character, 0, nchars)
	monolog.Info("Try to load %d characters:\n", nchars)
	for index := 0; index < nchars; index++ {

		chid := record.GetArrayIndex("characters", index)
		monolog.Info("Loading character: %d %s\n", index, chid)

		ch, err := account.LoadCharacter(dirname, chid)
		if err != nil {
			monolog.Error("Could not load character %s: %s", chid, err.Error())
			// return nil, err
		} else {
			account.characters = append(account.characters, ch)
		}
	}

	/* Todo: load characters here... */
	monolog.Info("Loaded Account: %s %v", path, account)
	return account, nil
}
开发者ID:beoran,项目名称:woe,代码行数:47,代码来源:account.go

示例9: Close

func (me *Server) Close() {
	monolog.Info("Closing server, shutting down tickers.")

	for name, _ := range me.tickers {
		me.RemoveTicker(name)
	}

	monolog.Info("Closing server, shutting down clients.")
	for _, client := range me.clients {
		if client.IsAlive() {
			client.Close()
		}
	}

	me.handleDisconnectedClients()
	monolog.Info("Closed server.")
}
开发者ID:beoran,项目名称:woe,代码行数:17,代码来源:server.go

示例10: SetupMSDP

// Check for MSDP (two way MSSP) support (but don't implement it yet)
func (me *Client) SetupMSDP() telnet.Event {

	ok, tev := me.SetupNegotiate(1000, t.TELNET_WILL, t.TELNET_TELOPT_MSDP, t.TELNET_DO_EVENT, t.TELNET_DONT_EVENT)
	if !ok {
		return tev
	}
	monolog.Info("Client %d accepts MSDP", me.id)
	me.info.msdp = true
	return nil
}
开发者ID:beoran,项目名称:woe,代码行数:11,代码来源:setuptelnet.go

示例11: SetupCompress2

// Negotiate COMPRESS2 support
func (me *Client) SetupCompress2() telnet.Event {
	ok, tev := me.SetupNegotiate(1000, t.TELNET_WILL, t.TELNET_TELOPT_COMPRESS2, t.TELNET_DO_EVENT, t.TELNET_DONT_EVENT)
	if !ok {
		return tev
	}

	me.telnet.TelnetBeginCompress2()
	monolog.Info("Client #{@id} started COMPRESS2 compression")
	me.info.compress2 = true
	return tev
}
开发者ID:beoran,项目名称:woe,代码行数:12,代码来源:setuptelnet.go

示例12: LoadWorld

// Load a world from a sitef file.
func LoadWorld(dirname string, name string) (world *World, err error) {

	path := SavePathFor(dirname, "world", name)

	records, err := sitef.ParseFilename(path)
	if err != nil {
		return nil, err
	}

	if len(records) < 1 {
		return nil, errors.New("No record found!")
	}

	record := records[0]
	monolog.Info("Loading World record: %s %v", path, record)

	world = NewWorld(record.Get("name"), record.Get("motd"), dirname)
	monolog.Info("Loaded World: %s %v", path, world)
	return world, nil
}
开发者ID:beoran,项目名称:woe,代码行数:21,代码来源:world.go

示例13: SetupBinary

// Negotiate BINARY support, for sending UTF-8. This is largely a courtesy to the cliennt,
// since woe will send UTF-8 anyway.
func (me *Client) SetupBinary() telnet.Event {
	ok, tev := me.SetupNegotiate(1000, t.TELNET_WILL, t.TELNET_TELOPT_BINARY, t.TELNET_DO_EVENT, t.TELNET_DONT_EVENT)
	if !ok {
		me.info.binary = false
		return tev
	}

	monolog.Info("Client #{@id} accepts BINARY")
	me.info.binary = true
	return tev
}
开发者ID:beoran,项目名称:woe,代码行数:13,代码来源:setuptelnet.go

示例14: SetupSupressGA

// negotiate suppress go ahead
func (me *Client) SetupSupressGA() telnet.Event {
	ok, tev := me.SetupNegotiate(1000, t.TELNET_WILL, t.TELNET_TELOPT_SGA, t.TELNET_DO_EVENT, t.TELNET_DONT_EVENT)
	if !ok {
		me.info.binary = false
		return tev
	}

	monolog.Info("Client #{@id} will suppress GA")
	me.info.sga = true
	return tev

}
开发者ID:beoran,项目名称:woe,代码行数:13,代码来源:setuptelnet.go

示例15: handleDisconnectedClients

func (me *Server) handleDisconnectedClients() {
	for me.alive {
		time.Sleep(1)
		for id, client := range me.clients {
			if !client.IsAlive() {
				monolog.Info("Client %d has disconnected.", client.id)
				client.Close()
				delete(me.clients, id)
			}
		}
	}
}
开发者ID:beoran,项目名称:woe,代码行数:12,代码来源:server.go


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