103 lines
2.3 KiB
Java
103 lines
2.3 KiB
Java
|
/*
|
||
|
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||
|
*
|
||
|
* 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 <http://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
package fr.devinsy.logar.app.log;
|
||
|
|
||
|
import java.time.LocalDateTime;
|
||
|
|
||
|
import org.slf4j.Logger;
|
||
|
import org.slf4j.LoggerFactory;
|
||
|
|
||
|
/**
|
||
|
* The Class Log.
|
||
|
*/
|
||
|
public final class Log
|
||
|
{
|
||
|
private static Logger logger = LoggerFactory.getLogger(Log.class);
|
||
|
|
||
|
private String line;
|
||
|
private LocalDateTime datetime;
|
||
|
private String ip;
|
||
|
private String user;
|
||
|
|
||
|
/**
|
||
|
* Instantiates a new log.
|
||
|
*/
|
||
|
public Log(final String line, final LocalDateTime datetime)
|
||
|
{
|
||
|
this.line = line;
|
||
|
this.datetime = datetime;
|
||
|
this.ip = null;
|
||
|
this.user = null;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Instantiates a new log.
|
||
|
*
|
||
|
* @param line
|
||
|
* the line
|
||
|
* @param datetime
|
||
|
* the datetime
|
||
|
* @param ip
|
||
|
* the ip
|
||
|
* @param user
|
||
|
* the login
|
||
|
*/
|
||
|
public Log(final String line, final LocalDateTime datetime, final String ip, final String user)
|
||
|
{
|
||
|
this.line = line;
|
||
|
this.datetime = datetime;
|
||
|
this.ip = ip;
|
||
|
this.user = user;
|
||
|
}
|
||
|
|
||
|
public LocalDateTime getDatetime()
|
||
|
{
|
||
|
return this.datetime;
|
||
|
}
|
||
|
|
||
|
public String getIp()
|
||
|
{
|
||
|
return this.ip;
|
||
|
}
|
||
|
|
||
|
public String getLine()
|
||
|
{
|
||
|
return this.line;
|
||
|
}
|
||
|
|
||
|
public String getUser()
|
||
|
{
|
||
|
return this.user;
|
||
|
}
|
||
|
|
||
|
/* (non-Javadoc)
|
||
|
* @see java.lang.Object#toString()
|
||
|
*/
|
||
|
@Override
|
||
|
public String toString()
|
||
|
{
|
||
|
String result;
|
||
|
|
||
|
result = this.line;
|
||
|
|
||
|
//
|
||
|
return result;
|
||
|
}
|
||
|
}
|