refactor(client): убрать deprecated-теги с package-level логгеров
cmd/client — однопроцессный CLI; package-level Log+SetLogger остаётся каноническим API. captcha.Solve по-прежнему принимает явный логгер для DI. Также осовременен backoffSteps через min().
This commit is contained in:
1 parent
5735b4a297
commit
6b8b82f530
3 files changed
+2
-20
No files matched your search
@@ -27,14 +27,10 @@ import (
|
||||
|
||||
// Log is the package-level logger. Defaults to no-op; main wires it via
|
||||
// SetLogger so captcha output respects the global -debug flag and levels.
|
||||
//
|
||||
// Deprecated: pass a logx.Logger to Solve directly. SetLogger remains for
|
||||
// callers that cannot be updated (e.g. auto_solver.go uses captcha.Log directly).
|
||||
// Solve also accepts an explicit logger parameter for callers that want DI.
|
||||
var Log logx.Logger = logx.Nop()
|
||||
|
||||
// SetLogger installs a logger for this package. Safe to call once at startup.
|
||||
//
|
||||
// Deprecated: prefer passing a logx.Logger to Solve.
|
||||
func SetLogger(l logx.Logger) { Log = logx.OrNop(l) }
|
||||
|
||||
const (
|
||||
@@ -158,10 +154,7 @@ func Solve(
|
||||
return "", solveErr
|
||||
}
|
||||
|
||||
backoffSteps := attempt
|
||||
if backoffSteps > 10 {
|
||||
backoffSteps = 10
|
||||
}
|
||||
backoffSteps := min(attempt, 10)
|
||||
timer := time.NewTimer(time.Duration(backoffSteps) * 500 * time.Millisecond)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
|
||||
@@ -35,14 +35,9 @@ var Debug bool
|
||||
|
||||
// Log is the package-level logger; defaults to no-op. main wires it via
|
||||
// SetLogger so manual-captcha output respects -debug and levels.
|
||||
//
|
||||
// Deprecated: future refactoring should inject the logger via a Solver struct.
|
||||
// SetLogger remains for backward compatibility.
|
||||
var Log logx.Logger = logx.Nop()
|
||||
|
||||
// SetLogger installs a logger for this package.
|
||||
//
|
||||
// Deprecated: prefer a Solver struct with an explicit Logger field.
|
||||
func SetLogger(l logx.Logger) { Log = logx.OrNop(l) }
|
||||
|
||||
const captchaListenPort = "8765"
|
||||
|
||||
@@ -27,15 +27,9 @@ import (
|
||||
|
||||
// Log is the package-level logger. Defaults to no-op; main wires it via
|
||||
// SetLogger so DNS-mode output respects the global -debug flag and levels.
|
||||
//
|
||||
// Deprecated: dnsdial is a procedural package with global state; a future
|
||||
// refactor should thread a logger through AppDialer/InstallGlobalResolver.
|
||||
// SetLogger remains for backward compatibility.
|
||||
var Log logx.Logger = logx.Nop()
|
||||
|
||||
// SetLogger installs a logger for this package.
|
||||
//
|
||||
// Deprecated: prefer threading a logx.Logger through AppDialer.
|
||||
func SetLogger(l logx.Logger) { Log = logx.OrNop(l) }
|
||||
|
||||
const (
|
||||
|
||||
Reference in new issue
Block a user