blob: 29be9e88d24a339860421684b39b750465784808 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache license, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the license for the specific language governing permissions and
* limitations under the license.
*/
package org.apache.logging.log4j.layout.json.template.resolver;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.lookup.MainMapLookup;
import org.apache.logging.log4j.layout.json.template.util.JsonWriter;
final class MainMapResolver implements EventResolver {
private static final MainMapLookup MAIN_MAP_LOOKUP = new MainMapLookup();
private final String key;
static String getName() {
return "main";
}
MainMapResolver(final String key) {
this.key = key;
}
@Override
public void resolve(
final LogEvent logEvent,
final JsonWriter jsonWriter) {
final String value = MAIN_MAP_LOOKUP.lookup(key);
jsonWriter.writeString(value);
}
}