summaryrefslogtreecommitdiff
path: root/vendor/github.com/docker/distribution/context/version.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/docker/distribution/context/version.go')
-rw-r--r--vendor/github.com/docker/distribution/context/version.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/vendor/github.com/docker/distribution/context/version.go b/vendor/github.com/docker/distribution/context/version.go
new file mode 100644
index 000000000..746cda02e
--- /dev/null
+++ b/vendor/github.com/docker/distribution/context/version.go
@@ -0,0 +1,16 @@
+package context
+
+// WithVersion stores the application version in the context. The new context
+// gets a logger to ensure log messages are marked with the application
+// version.
+func WithVersion(ctx Context, version string) Context {
+ ctx = WithValue(ctx, "version", version)
+ // push a new logger onto the stack
+ return WithLogger(ctx, GetLogger(ctx, "version"))
+}
+
+// GetVersion returns the application version from the context. An empty
+// string may returned if the version was not set on the context.
+func GetVersion(ctx Context) string {
+ return GetStringValue(ctx, "version")
+}