
com.nu.art.belog.BeLogged Maven / Gradle / Ivy
/*
* belog is an extendable infrastructure to manage and customize
* your application output.
*
* Copyright (C) 2018 Adam van der Kruk aka TacB0sS
*
* Licensed 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 com.nu.art.belog;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.nu.art.belog.BeConfig.LoggerConfig;
import com.nu.art.belog.BeConfig.Rule;
import com.nu.art.belog.consts.LogLevel;
import com.nu.art.belog.loggers.FileLogger.FileLoggerDescriptor;
import com.nu.art.belog.loggers.JavaLogger.JavaLoggerDescriptor;
import com.nu.art.core.exceptions.runtime.BadImplementationException;
import com.nu.art.core.exceptions.runtime.ImplementationMissingException;
import com.nu.art.core.interfaces.Condition;
import com.nu.art.core.interfaces.Getter;
import com.nu.art.core.interfaces.Serializer;
import com.nu.art.core.replacer.Replacer;
import com.nu.art.core.tools.ArrayTools;
import com.nu.art.core.tools.StreamTools;
import com.nu.art.core.utils.SynchronizedObject;
import com.nu.art.reflection.tools.ART_Tools;
import com.nu.art.reflection.tools.ReflectiveTools;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Pattern;
public final class BeLogged {
private static BeLogged INSTANCE;
public static synchronized BeLogged getInstance() {
if (INSTANCE == null)
INSTANCE = new BeLogged();
return INSTANCE;
}
private LogLevel minLogLevel = LogLevel.Verbose;
private LogLevel maxLogLevel = LogLevel.Assert;
private SynchronizedObject> syncLoggerSet = new SynchronizedObject<>(new Getter>() {
@Override
public HashSet get() {
return new HashSet<>();
}
});
private final Map>> descriptors = new HashMap<>();
private final HashMap configParams = new HashMap<>();
private final Map logClients = new ConcurrentHashMap<>();
private Rule[] rules = {};
private Serializer
© 2015 - 2025 Weber Informatics LLC | Privacy Policy