summaryrefslogtreecommitdiffstats
path: root/container-accesslogging/src/main/java/com/yahoo/container/logging/AccessLog.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
commit72231250ed81e10d66bfe70701e64fa5fe50f712 (patch)
tree2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /container-accesslogging/src/main/java/com/yahoo/container/logging/AccessLog.java
Publish
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.java34
1 files changed, 34 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..86cdd712031
--- /dev/null
+++ b/container-accesslogging/src/main/java/com/yahoo/container/logging/AccessLog.java
@@ -0,0 +1,34 @@
+// Copyright 2016 Yahoo Inc. 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;
+
+import java.net.InetSocketAddress;
+import java.net.URI;
+
+/**
+ * Logs to all the configured access logs.
+ * @author tonytv
+ */
+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(final AccessLogEntry accessLogEntry) {
+ for (AccessLogInterface log: implementers.allComponents()) {
+ log.log(accessLogEntry);
+ }
+ }
+
+}