diff --git a/src/fr/devinsy/logar/app/DryOption.java b/src/fr/devinsy/logar/app/DryOption.java new file mode 100644 index 0000000..b94bdcc --- /dev/null +++ b/src/fr/devinsy/logar/app/DryOption.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2021 Christian Pierre MOMON + * + * This file is part of Logar, simple tool to manage http log files. + * + * Logar is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * Logar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Logar. If not, see . + */ +package fr.devinsy.logar.app; + +/** + * The Enum DryOption. + */ +public enum DryOption +{ + ON, + OFF; + + /** + * Checks if is off. + * + * @return true, if is off + */ + public boolean isOff() + { + boolean result; + + result = (this == OFF); + + // + return result; + } + + /** + * Checks if is on. + * + * @return true, if is on + */ + public boolean isOn() + { + boolean result; + + result = (this == ON); + + // + return result; + } +} diff --git a/src/fr/devinsy/logar/app/Logar.java b/src/fr/devinsy/logar/app/Logar.java index acbb8da..9da78c3 100644 --- a/src/fr/devinsy/logar/app/Logar.java +++ b/src/fr/devinsy/logar/app/Logar.java @@ -24,11 +24,7 @@ import java.io.IOException; import java.io.PrintWriter; import java.time.LocalDateTime; import java.time.YearMonth; -import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; -import java.util.Locale; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import java.util.zip.GZIPOutputStream; import org.apache.commons.io.IOUtils; @@ -41,7 +37,8 @@ import org.slf4j.LoggerFactory; import fr.devinsy.logar.app.anonymizer.Anonymizer; import fr.devinsy.logar.app.log.Log; -import fr.devinsy.logar.app.log.LogUtils; +import fr.devinsy.logar.app.log.LogFile; +import fr.devinsy.logar.app.log.LogParser; /** * The Class Logar. @@ -50,8 +47,7 @@ public final class Logar { private static Logger logger = LoggerFactory.getLogger(Logar.class); - public static Pattern nginxAccessLogLinePattern = Pattern.compile("^\\S+ - [^\\[]+ \\[(?