Skip to content

Commit 61b17be

Browse files
committed
log: deprecate log.* global functions
Add a comment to global functions in log package that log to the dev channel. In the future these will be removed and it will be required to specify the log channel that a log will be written to. This is intended to reduce the amount of logs that are sent to DEV by require engineers to be explicit about where they want to log Epic: CRDB-53410 Release note: None
1 parent 34a67e1 commit 61b17be

File tree

2 files changed

+144
-0
lines changed

2 files changed

+144
-0
lines changed

pkg/util/log/gen/main.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,12 @@ func (logger{{.Name}}) {{with $sev}}{{.Name}}{{end}}fDepth(ctx context.Context,
352352
{{.Comment -}}
353353
//
354354
{{with $sev}}{{.Comment}}{{end -}}
355+
//
356+
// TODO: to avoid linting failures, we don't include details about
357+
// alternative usage. Once all usages have been replaced, update the
358+
// deprecation comment to describe the replacement functions
359+
//
360+
// Deprecated
355361
func {{with $sev}}{{.Name}}{{end}}f(ctx context.Context, format string, args ...interface{}) {
356362
logfDepth(ctx, 1, severity.{{with $sev}}{{.NAME}}{{end}}, channel.{{.NAME}}, format, args...)
357363
}
@@ -363,6 +369,12 @@ func {{with $sev}}{{.Name}}{{end}}f(ctx context.Context, format string, args ...
363369
{{.Comment -}}
364370
//
365371
{{with $sev}}{{.Comment}}{{end -}}
372+
//
373+
// TODO: to avoid linting failures, we don't include details about
374+
// alternative usage. Once all usages have been replaced, update the
375+
// deprecation comment to describe the replacement functions
376+
//
377+
// Deprecated
366378
func V{{with $sev}}{{.Name}}{{end}}f(ctx context.Context, level Level, format string, args ...interface{}) {
367379
if VDepth(level, 1) {
368380
logfDepth(ctx, 1, severity.{{with $sev}}{{.NAME}}{{end}}, channel.{{.NAME}}, format, args...)
@@ -376,6 +388,12 @@ func V{{with $sev}}{{.Name}}{{end}}f(ctx context.Context, level Level, format st
376388
{{.Comment -}}
377389
//
378390
{{with $sev}}{{.Comment}}{{end -}}
391+
//
392+
// TODO: to avoid linting failures, we don't include details about
393+
// alternative usage. Once all usages have been replaced, update the
394+
// deprecation comment to describe the replacement functions
395+
//
396+
// Deprecated
379397
func {{with $sev}}{{.Name}}{{end}}(ctx context.Context, msg string) {
380398
logfDepth(ctx, 1, severity.{{with $sev}}{{.NAME}}{{end}}, channel.{{.NAME}}, msg)
381399
}
@@ -388,6 +406,12 @@ func {{with $sev}}{{.Name}}{{end}}(ctx context.Context, msg string) {
388406
{{.Comment -}}
389407
//
390408
{{with $sev}}{{.Comment}}{{end -}}
409+
//
410+
// TODO: to avoid linting failures, we don't include details about
411+
// alternative usage. Once all usages have been replaced, update the
412+
// deprecation comment to describe the replacement functions
413+
//
414+
// Deprecated
391415
func {{with $sev}}{{.Name}}{{end}}fDepth(ctx context.Context, depth int, format string, args ...interface{}) {
392416
logfDepth(ctx, depth+1, severity.{{with $sev}}{{.NAME}}{{end}}, channel.{{.NAME}}, format, args...)
393417
}
@@ -441,6 +465,12 @@ func (logger{{.Name}}) VEventfDepth(ctx context.Context, depth int, level Level,
441465
// is currently redirected to a file.
442466
//
443467
{{.Comment -}}
468+
//
469+
// TODO: to avoid linting failures, we don't include details about
470+
// alternative usage. Once all usages have been replaced, update the
471+
// deprecation comment to describe the replacement functions
472+
//
473+
// Deprecated
444474
func Shout(ctx context.Context, sev Severity, msg string) {
445475
shoutfDepth(ctx, 1, sev, channel.{{.NAME}}, msg)
446476
}
@@ -450,6 +480,12 @@ func Shout(ctx context.Context, sev Severity, msg string) {
450480
// the manner of fmt.Printf.
451481
//
452482
{{.Comment -}}
483+
//
484+
// TODO: to avoid linting failures, we don't include details about
485+
// alternative usage. Once all usages have been replaced, update the
486+
// deprecation comment to describe the replacement functions
487+
//
488+
// Deprecated
453489
func Shoutf(ctx context.Context, sev Severity, format string, args ...interface{}) {
454490
shoutfDepth(ctx, 1, sev, channel.{{.NAME}}, format, args...)
455491
}

pkg/util/log/log_channels_generated.go

Lines changed: 108 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)