本文整理汇总了Golang中github.com/beoran/woe/monolog.Info函数的典型用法代码示例。如果您正苦于以下问题:Golang Info函数的具体用法?Golang Info怎么用?Golang Info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Info函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: SetupWorld
func (me *Server) SetupWorld() (err error) {
me.World, err = world.LoadWorld(me.DataPath(), "WOE")
if err != nil {
monolog.Error("Could not load world WOE: %s", err)
return err
}
if me.World == nil {
monolog.Info("Creating new default world...")
me.World = world.NewWorld("WOE", DEFAULT_MOTD, me.DataPath())
err := me.World.Save(me.DataPath())
if err != nil {
monolog.Error("Could not save world: %v", err)
return err
} else {
monolog.Info("Saved default world.")
}
}
return nil
}
开发者ID:beoran,项目名称:woe,代码行数:21,代码来源:server.go
示例17: LoadItem
// Load an item from a sitef file.
func LoadItem(dirname string, id string) (item *Item, err error) {
path := SavePathFor(dirname, "item", id)
records, err := sitef.ParseFilename(path)
if err != nil {
return nil, err
}
if len(records) < 1 {
return nil, errors.New("No item found!")
}
record := records[0]
monolog.Info("Loading Item record: %s %v", path, record)
item = new(Item)
item.Entity.LoadSitef(*record)
item.Quality = record.GetIntDefault("quality", 0)
item.Price = record.GetIntDefault("price", -1)
item.Level = record.GetIntDefault("level", -1)
item.Kind = ItemKind(record.Get("kind"))
item.Damage = DamageKind(record.Get("damage"))
item.Equip = EquipWhere(record.Get("equip"))
item.Upgrade = record.Get("upgrade")
item.Degrade = record.Get("degrade")
item.Teaches = record.Get("teaches")
item.Craft = record.Get("craft")
ningredients := record.GetIntDefault("ingredients", 0)
for i := 0; i < ningredients; i++ {
ingr := record.GetArrayIndex("ingredients", i)
item.Ingredients = append(item.Ingredients, ingr)
}
monolog.Info("Loaded Item: %s %v", path, item)
return item, nil
}
开发者ID:beoran,项目名称:woe,代码行数:40,代码来源:item.go
示例18: Delete
// Deletes the character itself from disk
func (me *Character) Delete(dirname string) bool {
path := SavePathFor(dirname, "character", me.ID)
if err := os.Remove(path); err != nil {
monolog.Warning("Could not delete character: %v %s: %s",
me, path, err.Error())
return false
}
me.Account = nil
monolog.Info("Character deleted: %s", me.ID)
return true
}
开发者ID:beoran,项目名称:woe,代码行数:14,代码来源:character.go
示例19: runServer
func runServer() (status int) {
monolog.Setup("woe.log", true, false)
defer monolog.Close()
enableDisableLogs()
monolog.Info("Starting WOE server...")
monolog.Info("Server will run at %s.", *server_tcpip)
woe, err := server.NewServer(*server_tcpip)
if err != nil {
monolog.Error("Could not initialize server!")
monolog.Error(err.Error())
panic(err)
}
monolog.Info("Server at %s init ok.", *server_tcpip)
defer woe.Close()
status, err = woe.Serve()
if err != nil {
monolog.Error("Error while running WOE server!")
monolog.Error(err.Error())
panic(err)
}
monolog.Info("Server shut down without error indication.", *server_tcpip)
return status
}
开发者ID:beoran,项目名称:woe,代码行数:23,代码来源:woe.go
示例20: NewServer
func NewServer(address string) (server *Server, err error) {
listener, err := net.Listen("tcp", address)
if err != nil {
return nil, err
}
monolog.Info("Server listening on %s.", address)
clients := make(map[int]*Client)
tickers := make(map[string]*Ticker)
server = &Server{address, listener, clients, tickers, true, nil, STATUS_RESTART}
err = server.SetupWorld()
if err != nil {
monolog.Error("Could not set up or load world!")
return nil, err
}
monolog.Info("Server world set up.")
server.AddDefaultTickers()
monolog.Info("Tickers set up.")
return server, err
}
开发者ID:beoran,项目名称:woe,代码行数:24,代码来源:server.go
注:本文中的github.com/beoran/woe/monolog.Info函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论