chore(opencode): не логировать тела API-запросов/ответов, только метаданные
This commit is contained in:
@@ -64,9 +64,6 @@ func (c *Client) do(ctx context.Context, method, path, op string, body []byte) (
|
|||||||
}
|
}
|
||||||
if c.Debug {
|
if c.Debug {
|
||||||
log.Printf("opencode api %s -> %s %s%s", op, method, c.BaseURL, path)
|
log.Printf("opencode api %s -> %s %s%s", op, method, c.BaseURL, path)
|
||||||
if len(body) > 0 {
|
|
||||||
log.Printf("opencode api %s request body: %s", op, truncateStr(string(body), 5000))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
resp, err := c.http.Do(req)
|
resp, err := c.http.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -79,12 +76,12 @@ func (c *Client) do(ctx context.Context, method, path, op string, body []byte) (
|
|||||||
}
|
}
|
||||||
if resp.StatusCode < 200 || resp.StatusCode > 299 {
|
if resp.StatusCode < 200 || resp.StatusCode > 299 {
|
||||||
if c.Debug {
|
if c.Debug {
|
||||||
log.Printf("opencode api %s response: status %d: %s", op, resp.StatusCode, truncateStr(string(b), 1000))
|
log.Printf("opencode api %s response: status %d", op, resp.StatusCode)
|
||||||
}
|
}
|
||||||
return nil, &ClientErr{Op: op, Err: fmt.Errorf("status %d: %s", resp.StatusCode, truncateStr(string(b), 300))}
|
return nil, &ClientErr{Op: op, Err: fmt.Errorf("status %d: %s", resp.StatusCode, truncateStr(string(b), 300))}
|
||||||
}
|
}
|
||||||
if c.Debug {
|
if c.Debug {
|
||||||
log.Printf("opencode api %s response (%d bytes): %s", op, len(b), truncateStr(string(b), 5000))
|
log.Printf("opencode api %s response (%d bytes)", op, len(b))
|
||||||
}
|
}
|
||||||
return b, nil
|
return b, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user