mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-24 09:50:00 +08:00
feat: replace log with logrus
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -13,6 +12,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/httprunner/hrp"
|
||||
)
|
||||
@@ -120,7 +120,7 @@ func (h *HAR) prepareTestSteps() ([]*hrp.TStep, error) {
|
||||
}
|
||||
|
||||
func (h *HAR) prepareTestStep(entry *Entry) (*hrp.TStep, error) {
|
||||
log.Printf("[prepareTestStep] %v %v", entry.Request.Method, entry.Request.URL)
|
||||
log.Infof("[prepareTestStep] %v %v", entry.Request.Method, entry.Request.URL)
|
||||
tStep := &TStep{
|
||||
TStep: hrp.TStep{
|
||||
Request: &hrp.TRequest{},
|
||||
@@ -164,7 +164,7 @@ func (s *TStep) makeRequestURL(entry *Entry) error {
|
||||
|
||||
u, err := url.Parse(entry.Request.URL)
|
||||
if err != nil {
|
||||
log.Printf("makeRequestURL error: %v", err)
|
||||
log.Errorf("makeRequestURL error: %v", err)
|
||||
return err
|
||||
}
|
||||
s.Request.URL = fmt.Sprintf("%s://%s", u.Scheme, u.Hostname()+u.Path)
|
||||
@@ -211,7 +211,7 @@ func (s *TStep) makeRequestBody(entry *Entry) error {
|
||||
var body interface{}
|
||||
err := json.Unmarshal([]byte(entry.Request.PostData.Text), &body)
|
||||
if err != nil {
|
||||
log.Printf("makeRequestBody error: %v", err)
|
||||
log.Errorf("makeRequestBody error: %v", err)
|
||||
return err
|
||||
}
|
||||
s.Request.Body = body
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package har2case
|
||||
|
||||
import (
|
||||
"log"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -14,7 +13,6 @@ var (
|
||||
|
||||
func TestGenJSON(t *testing.T) {
|
||||
jsonPath, err := NewHAR(harPath).GenJSON()
|
||||
log.Printf("jsonPath: %v, err: %v", jsonPath, err)
|
||||
if !assert.NoError(t, err) {
|
||||
t.Fail()
|
||||
}
|
||||
@@ -25,7 +23,6 @@ func TestGenJSON(t *testing.T) {
|
||||
|
||||
func TestGenYAML(t *testing.T) {
|
||||
yamlPath, err := NewHAR(harPath2).GenYAML()
|
||||
log.Printf("yamlPath: %v, err: %v", yamlPath, err)
|
||||
if !assert.NoError(t, err) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user