Beispiel #1
0
func (info *JavaFileInfo) GenJavaInfo(s string) {
	info.info_ = make(map[string]string)
	line_num := 0
	start_index := 0
	context_start_index := 0
	for i := 0; i < len(s); i++ {
		if s[i] == '\n' {
			if start_index > 0 {
				start_index++
			}
			context_start_index = start_index + len(key_arr_java[line_num]) + 1

			if line_num == 5 {
				info.info_[key_arr_java[line_num]] = s[start_index:]
			} else {
				info.info_[key_arr_java[line_num]] = s[context_start_index:i]
			}

			start_index = i
			line_num++
			if line_num >= len(key_arr_java) {
				break
			}
		}
	}

	if info.info_["file"] == "" {
		info.info_["file"] = s[start_index+len(key_arr_java[5])+2:]
	}

	path := "./" + info.project + "/dump/" + info.info_["version"]
	file.CreateDir(path)
	info.file_name_ = info.info_["UUID"] + ".txt"
	file.WriteFile(path+"/"+info.file_name_, []byte(info.info_["file"]), os.O_TRUNC)
}
Beispiel #2
0
func (info *DumpFileInfo) GenLogInfo(s string) {

	info.info_ = make(map[string]string)
	line_num := 0
	start_index := 0
	context_start_index := 0
	for i := 0; i < len(s); i++ {
		if s[i] == '\n' {
			if start_index > 0 {
				start_index++
			}
			context_start_index = start_index + len(key_arr_log[line_num]) + 1

			if line_num == 5 {
				info.info_[key_arr_log[line_num]] = s[start_index:]
			} else {
				info.info_[key_arr_log[line_num]] = s[context_start_index:i]
			}

			start_index = i
			line_num++
			if line_num >= len(key_arr_log) {
				break
			}
		}
	}

	path := "./" + info.project + "/dump/" + info.info_["version"]
	file.CreateDir(path)
	//info.file_name_ = "crash_" + info.info_["UUID"] + "_" + time.Now().Format(time.RFC3339) + ".txt"
	info.file_name_ = info.info_["UUID"] + ".log"
	file.WriteFile(path+"/"+info.file_name_, []byte(info.info_["file"]), os.O_TRUNC)

}