info->notice, debug->info

This commit is contained in:
Ethan Buchman
2015-07-19 21:49:13 +00:00
parent e087284a4f
commit bb4ca1407f
26 changed files with 239 additions and 239 deletions

View File

@ -260,7 +260,7 @@ func readReflectBinary(rv reflect.Value, rt reflect.Type, opts Options, r io.Rea
if *err != nil {
return
}
log.Debug("Read bytearray", "bytes", buf)
log.Info("Read bytearray", "bytes", buf)
reflect.Copy(rv, reflect.ValueOf(buf))
} else {
for i := 0; i < length; i++ {
@ -274,7 +274,7 @@ func readReflectBinary(rv reflect.Value, rt reflect.Type, opts Options, r io.Rea
return
}
}
log.Debug(Fmt("Read %v-array", elemRt), "length", length)
log.Info(Fmt("Read %v-array", elemRt), "length", length)
}
case reflect.Slice:
@ -282,13 +282,13 @@ func readReflectBinary(rv reflect.Value, rt reflect.Type, opts Options, r io.Rea
if elemRt.Kind() == reflect.Uint8 {
// Special case: Byteslices
byteslice := ReadByteSlice(r, n, err)
log.Debug("Read byteslice", "bytes", byteslice)
log.Info("Read byteslice", "bytes", byteslice)
rv.Set(reflect.ValueOf(byteslice))
} else {
var sliceRv reflect.Value
// Read length
length := ReadVarint(r, n, err)
log.Debug(Fmt("Read length: %v", length))
log.Info(Fmt("Read length: %v", length))
sliceRv = reflect.MakeSlice(rt, 0, 0)
// read one ReflectSliceChunk at a time and append
for i := 0; i*ReflectSliceChunk < length; i++ {
@ -315,7 +315,7 @@ func readReflectBinary(rv reflect.Value, rt reflect.Type, opts Options, r io.Rea
if rt == timeType {
// Special case: time.Time
t := ReadTime(r, n, err)
log.Debug(Fmt("Read time: %v", t))
log.Info(Fmt("Read time: %v", t))
rv.Set(reflect.ValueOf(t))
} else {
for _, fieldInfo := range typeInfo.Fields {
@ -327,74 +327,74 @@ func readReflectBinary(rv reflect.Value, rt reflect.Type, opts Options, r io.Rea
case reflect.String:
str := ReadString(r, n, err)
log.Debug(Fmt("Read string: %v", str))
log.Info(Fmt("Read string: %v", str))
rv.SetString(str)
case reflect.Int64:
if opts.Varint {
num := ReadVarint(r, n, err)
log.Debug(Fmt("Read num: %v", num))
log.Info(Fmt("Read num: %v", num))
rv.SetInt(int64(num))
} else {
num := ReadInt64(r, n, err)
log.Debug(Fmt("Read num: %v", num))
log.Info(Fmt("Read num: %v", num))
rv.SetInt(int64(num))
}
case reflect.Int32:
num := ReadUint32(r, n, err)
log.Debug(Fmt("Read num: %v", num))
log.Info(Fmt("Read num: %v", num))
rv.SetInt(int64(num))
case reflect.Int16:
num := ReadUint16(r, n, err)
log.Debug(Fmt("Read num: %v", num))
log.Info(Fmt("Read num: %v", num))
rv.SetInt(int64(num))
case reflect.Int8:
num := ReadUint8(r, n, err)
log.Debug(Fmt("Read num: %v", num))
log.Info(Fmt("Read num: %v", num))
rv.SetInt(int64(num))
case reflect.Int:
num := ReadVarint(r, n, err)
log.Debug(Fmt("Read num: %v", num))
log.Info(Fmt("Read num: %v", num))
rv.SetInt(int64(num))
case reflect.Uint64:
if opts.Varint {
num := ReadVarint(r, n, err)
log.Debug(Fmt("Read num: %v", num))
log.Info(Fmt("Read num: %v", num))
rv.SetUint(uint64(num))
} else {
num := ReadUint64(r, n, err)
log.Debug(Fmt("Read num: %v", num))
log.Info(Fmt("Read num: %v", num))
rv.SetUint(uint64(num))
}
case reflect.Uint32:
num := ReadUint32(r, n, err)
log.Debug(Fmt("Read num: %v", num))
log.Info(Fmt("Read num: %v", num))
rv.SetUint(uint64(num))
case reflect.Uint16:
num := ReadUint16(r, n, err)
log.Debug(Fmt("Read num: %v", num))
log.Info(Fmt("Read num: %v", num))
rv.SetUint(uint64(num))
case reflect.Uint8:
num := ReadUint8(r, n, err)
log.Debug(Fmt("Read num: %v", num))
log.Info(Fmt("Read num: %v", num))
rv.SetUint(uint64(num))
case reflect.Uint:
num := ReadVarint(r, n, err)
log.Debug(Fmt("Read num: %v", num))
log.Info(Fmt("Read num: %v", num))
rv.SetUint(uint64(num))
case reflect.Bool:
num := ReadUint8(r, n, err)
log.Debug(Fmt("Read bool: %v", num))
log.Info(Fmt("Read bool: %v", num))
rv.SetBool(num > 0)
default:
@ -669,7 +669,7 @@ func readReflectJSON(rv reflect.Value, rt reflect.Type, o interface{}, err *erro
*err = errors.New(Fmt("Expected bytearray of length %v but got %v", length, len(buf)))
return
}
log.Debug("Read bytearray", "bytes", buf)
log.Info("Read bytearray", "bytes", buf)
reflect.Copy(rv, reflect.ValueOf(buf))
} else {
oSlice, ok := o.([]interface{})
@ -685,7 +685,7 @@ func readReflectJSON(rv reflect.Value, rt reflect.Type, o interface{}, err *erro
elemRv := rv.Index(i)
readReflectJSON(elemRv, elemRt, oSlice[i], err)
}
log.Debug(Fmt("Read %v-array", elemRt), "length", length)
log.Info(Fmt("Read %v-array", elemRt), "length", length)
}
case reflect.Slice:
@ -702,7 +702,7 @@ func readReflectJSON(rv reflect.Value, rt reflect.Type, o interface{}, err *erro
*err = err_
return
}
log.Debug("Read byteslice", "bytes", byteslice)
log.Info("Read byteslice", "bytes", byteslice)
rv.Set(reflect.ValueOf(byteslice))
} else {
// Read length
@ -712,7 +712,7 @@ func readReflectJSON(rv reflect.Value, rt reflect.Type, o interface{}, err *erro
return
}
length := len(oSlice)
log.Debug(Fmt("Read length: %v", length))
log.Info(Fmt("Read length: %v", length))
sliceRv := reflect.MakeSlice(rt, length, length)
// Read elems
for i := 0; i < length; i++ {
@ -730,7 +730,7 @@ func readReflectJSON(rv reflect.Value, rt reflect.Type, o interface{}, err *erro
*err = errors.New(Fmt("Expected string but got type %v", reflect.TypeOf(o)))
return
}
log.Debug(Fmt("Read time: %v", str))
log.Info(Fmt("Read time: %v", str))
t, err_ := time.Parse(rfc2822, str)
if err_ != nil {
*err = err_
@ -762,7 +762,7 @@ func readReflectJSON(rv reflect.Value, rt reflect.Type, o interface{}, err *erro
*err = errors.New(Fmt("Expected string but got type %v", reflect.TypeOf(o)))
return
}
log.Debug(Fmt("Read string: %v", str))
log.Info(Fmt("Read string: %v", str))
rv.SetString(str)
case reflect.Int64, reflect.Int32, reflect.Int16, reflect.Int8, reflect.Int:
@ -771,7 +771,7 @@ func readReflectJSON(rv reflect.Value, rt reflect.Type, o interface{}, err *erro
*err = errors.New(Fmt("Expected numeric but got type %v", reflect.TypeOf(o)))
return
}
log.Debug(Fmt("Read num: %v", num))
log.Info(Fmt("Read num: %v", num))
rv.SetInt(int64(num))
case reflect.Uint64, reflect.Uint32, reflect.Uint16, reflect.Uint8, reflect.Uint:
@ -784,7 +784,7 @@ func readReflectJSON(rv reflect.Value, rt reflect.Type, o interface{}, err *erro
*err = errors.New(Fmt("Expected unsigned numeric but got %v", num))
return
}
log.Debug(Fmt("Read num: %v", num))
log.Info(Fmt("Read num: %v", num))
rv.SetUint(uint64(num))
case reflect.Bool:
@ -793,7 +793,7 @@ func readReflectJSON(rv reflect.Value, rt reflect.Type, o interface{}, err *erro
*err = errors.New(Fmt("Expected boolean but got type %v", reflect.TypeOf(o)))
return
}
log.Debug(Fmt("Read boolean: %v", bl))
log.Info(Fmt("Read boolean: %v", bl))
rv.SetBool(bl)
default:
@ -803,7 +803,7 @@ func readReflectJSON(rv reflect.Value, rt reflect.Type, o interface{}, err *erro
}
func writeReflectJSON(rv reflect.Value, rt reflect.Type, w io.Writer, n *int64, err *error) {
log.Debug(Fmt("writeReflectJSON(%v, %v, %v, %v, %v)", rv, rt, w, n, err))
log.Info(Fmt("writeReflectJSON(%v, %v, %v, %v, %v)", rv, rt, w, n, err))
// Get typeInfo
typeInfo := GetTypeInfo(rt)

View File

@ -356,7 +356,7 @@ func TestBinary(t *testing.T) {
for i, testCase := range testCases {
log.Info(fmt.Sprintf("Running test case %v", i))
log.Notice(fmt.Sprintf("Running test case %v", i))
// Construct an object
o := testCase.Constructor()
@ -398,7 +398,7 @@ func TestJSON(t *testing.T) {
for i, testCase := range testCases {
log.Info(fmt.Sprintf("Running test case %v", i))
log.Notice(fmt.Sprintf("Running test case %v", i))
// Construct an object
o := testCase.Constructor()