diff options
Diffstat (limited to 'container-accesslogging/src/main/java/com/yahoo/container/logging/AccessLog.java')
-rw-r--r-- | container-accesslogging/src/main/java/com/yahoo/container/logging/AccessLog.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/container-accesslogging/src/main/java/com/yahoo/container/logging/AccessLog.java b/container-accesslogging/src/main/java/com/yahoo/container/logging/AccessLog.java new file mode 100644 index 00000000000..5c1a549070c --- /dev/null +++ b/container-accesslogging/src/main/java/com/yahoo/container/logging/AccessLog.java @@ -0,0 +1,32 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.container.logging; + + +import com.google.inject.Inject; +import com.yahoo.component.provider.ComponentRegistry; + +/** + * Logs to all the configured access logs. + * + * @author Tony Vaagenes + */ +public class AccessLog { + + private ComponentRegistry<AccessLogInterface> implementers; + + @Inject + public AccessLog(ComponentRegistry<AccessLogInterface> implementers) { + this.implementers = implementers; + } + + public static AccessLog voidAccessLog() { + return new AccessLog(new ComponentRegistry<>()); + } + + public void log(AccessLogEntry accessLogEntry) { + for (AccessLogInterface log: implementers.allComponents()) { + log.log(accessLogEntry); + } + } + +} |