summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nslcd_server/ctx.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/nslcd_server/ctx.go b/nslcd_server/ctx.go
index 9722017..f80c930 100644
--- a/nslcd_server/ctx.go
+++ b/nslcd_server/ctx.go
@@ -1,4 +1,4 @@
-// Copyright (C) 2017 Luke Shumaker <lukeshu@sbcglobal.net>
+// Copyright (C) 2017-2018 Luke Shumaker <lukeshu@sbcglobal.net>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -25,8 +25,8 @@ import (
)
// Logger is the common interface between
-// `"git.lukeshu.com/go/libsystemd/sd_daemon".Logger` and
-// `"log/syslog".Writer`.
+// "git.lukeshu.com/go/libsystemd/sd_daemon".Logger and
+// "log/syslog".Writer.
type Logger interface {
Emerg(m string) error
Alert(m string) error
@@ -67,6 +67,8 @@ func PeerCredFromContext(ctx context.Context) (unix.Ucred, bool) {
return cred, ok
}
+// LoggerFromcontext returns the value associated with LoggerKey, or
+// an Stderr logger if there is no value associated with LoggerKey.
func LoggerFromContext(ctx context.Context) Logger {
logger, ok := ctx.Value(LoggerKey).(Logger)
if !ok {