Example #1
0
func init() {
	// 设置日志文件的存储目录
	logUtil.SetLogPath(filepath.Join(fileUtil.GetCurrentPath(), "LOG"))

	// 设置WaitGroup需要等待的数量
	wg.Add(1)
}
Example #2
0
func init() {
	// 设置日志文件的存储目录
	logUtil.SetLogPath(filepath.Join(fileUtil.GetCurrentPath(), LOG_PATH_SUFFIX))

	// 记录启动成功日志
	logUtil.Log("客户端启动成功", logUtil.Info, true)
}
Example #3
0
func init() {
	// 设置日志文件的存储目录
	logUtil.SetLogPath(filepath.Join(fileUtil.GetCurrentPath(), "LOG"))

	var err error

	// 读取配置文件内容
	config, err := configUtil.ReadJsonConfig(CONFIG_FILE_NAME)
	checkError(err)

	ServerGroupId, err = configUtil.ReadIntJsonValue(config, "ServerGroupId")
	checkError(err)
	ServerActivateUrl, err = configUtil.ReadStringJsonValue(config, "ServerActivateUrl")
	checkError(err)
	GameDBConnection, err = configUtil.ReadStringJsonValue(config, "GameDBConnection")
	checkError(err)
	GameModelDBConnection, err = configUtil.ReadStringJsonValue(config, "GameModelDBConnection")
	checkError(err)
	DEBUG, err = configUtil.ReadBoolJsonValue(config, "DEBUG")
	checkError(err)

	// 激活服务器
	err = manageUtil.ActivateServer(ServerActivateUrl, ServerGroupId)
	if err != nil {
		checkError(fmt.Errorf("激活服务器失败,错误信息为:", err))
	}

	DBConnectionString = manageUtil.GetDBConnectionString()
}
Example #4
0
func init() {
	// 设置日志文件的存储目录
	logUtil.SetLogPath(filepath.Join(fileUtil.GetCurrentPath(), LOG_PATH_SUFFIX))
}
Example #5
0
	"github.com/Jordanzuo/ChatServer_Go/src/model/chatMessage"
	"github.com/Jordanzuo/goutil/fileUtil"
	"github.com/Jordanzuo/goutil/logUtil"
	"github.com/Jordanzuo/goutil/stringUtil"
	"github.com/Jordanzuo/goutil/timeUtil"
	"os"
	"path/filepath"
	"time"
)

var (
	// 存放消息的通道
	messageChan = make(chan *chatMessage.ChatMessage, 100000)

	// 消息文件夹路径
	messageFolderPath string = filepath.Join(fileUtil.GetCurrentPath(), configBLL.MessageFolder())
)

func init() {
	if configBLL.IfRecordMessage() == false {
		return
	}

	// 判断文件夹是否存在,如果不存在则创建
	if !fileUtil.IsDirExists(messageFolderPath) {
		os.MkdirAll(messageFolderPath, os.ModePerm|os.ModeTemporary)
	}

	// 启动新Gorountine来处理消息
	go recordMessage()
}
Example #6
0
func init() {
	currPath := fileUtil.GetCurrentPath()

	SAVE_DATA_PATH = filepath.Join(currPath, "SaveData")
	FAIL_DATA_PATH = filepath.Join(currPath, "FailData")
}