Export logs content with hexary encoding (#1457)
This commit is contained in:
parent
14c513bd5a
commit
74b29ed4f3
|
@ -3,14 +3,12 @@ package exportlogs
|
|||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/status-im/go-ethereum/common/hexutil"
|
||||
)
|
||||
|
||||
// Log contains actual log content and filename. If content is gzipped Compressed will be set to true.
|
||||
type Log struct {
|
||||
Filename string
|
||||
Content []byte
|
||||
Content string
|
||||
Compressed bool
|
||||
}
|
||||
|
||||
|
@ -28,7 +26,7 @@ func ExportFromBaseFile(logFile string) ExportResponse {
|
|||
return ExportResponse{Error: fmt.Errorf("error reading file %s: %v", logFile, err).Error()}
|
||||
}
|
||||
return ExportResponse{Logs: []Log{
|
||||
{Filename: logFile, Compressed: false, Content: hexutil.Bytes(data)},
|
||||
{Filename: logFile, Compressed: false, Content: string(data)},
|
||||
}}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ func TestExportLogs(t *testing.T) {
|
|||
log := response.Logs[0]
|
||||
require.Equal(t, false, log.Compressed)
|
||||
require.Equal(t, tempf.Name(), log.Filename)
|
||||
require.Equal(t, logs, string(log.Content))
|
||||
require.Equal(t, logs, log.Content)
|
||||
}
|
||||
|
||||
func TestExportLogsNoFileError(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue