mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-20 12:36:07 -05:00
Resolves #114 issue with event log entries missing single quotes around date and time values.
This commit is contained in:
@@ -30,7 +30,8 @@ public abstract class CallEvent implements Comparable<CallEvent>
|
|||||||
protected long mEventStart = System.currentTimeMillis();
|
protected long mEventStart = System.currentTimeMillis();
|
||||||
protected long mEventEnd;
|
protected long mEventEnd;
|
||||||
|
|
||||||
private SimpleDateFormat mSDF = new SimpleDateFormat("yyyyMMdd','HHmmss");
|
private SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
private SimpleDateFormat TIME_FORMATTER = new SimpleDateFormat("HHmmss");
|
||||||
|
|
||||||
protected DecoderType mDecoderType;
|
protected DecoderType mDecoderType;
|
||||||
protected CallEventType mCallEventType;
|
protected CallEventType mCallEventType;
|
||||||
@@ -176,15 +177,23 @@ public abstract class CallEvent implements Comparable<CallEvent>
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
sb.append("'");
|
sb.append("'");
|
||||||
sb.append(mSDF.format(new Date(getEventStartTime())));
|
|
||||||
|
Date eventStart = new Date(getEventStartTime());
|
||||||
|
sb.append(DATE_FORMATTER.format(eventStart));
|
||||||
|
sb.append("','");
|
||||||
|
sb.append(TIME_FORMATTER.format(eventStart));
|
||||||
sb.append("','");
|
sb.append("','");
|
||||||
if(mEventEnd != 0)
|
if(mEventEnd != 0)
|
||||||
{
|
{
|
||||||
sb.append(mSDF.format(new Date(getEventEndTime())));
|
Date eventEnd = new Date(getEventEndTime());
|
||||||
|
sb.append(DATE_FORMATTER.format(eventEnd));
|
||||||
|
sb.append("','");
|
||||||
|
sb.append(TIME_FORMATTER.format(eventEnd));
|
||||||
|
sb.append("','");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb.append("','");
|
sb.append("','',");
|
||||||
}
|
}
|
||||||
sb.append("','");
|
sb.append("','");
|
||||||
sb.append(getDecoderType().toString());
|
sb.append(getDecoderType().toString());
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,9 +14,15 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.log;
|
package module.log;
|
||||||
|
|
||||||
|
import module.Module;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import util.TimeStamp;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
@@ -26,22 +32,12 @@ import java.io.Writer;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
|
||||||
import module.Module;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import util.TimeStamp;
|
|
||||||
|
|
||||||
public abstract class EventLogger extends Module
|
public abstract class EventLogger extends Module
|
||||||
{
|
{
|
||||||
private final static Logger mLog =
|
private final static Logger mLog = LoggerFactory.getLogger(EventLogger.class);
|
||||||
LoggerFactory.getLogger( EventLogger.class );
|
|
||||||
|
|
||||||
/* Illegal filename characters */
|
private static final String[] ILLEGAL_FILENAME_CHARACTERS = {"#", "%", "&", "{", "}", "\\", "<", ">",
|
||||||
private static final String[] mIllegalCharacters =
|
"*", "?", "/", " ", "$", "!", "'", "\"", ":", "@", "+", "`", "|", "="};
|
||||||
{ "#", "%", "&", "{", "}", "\\", "<", ">", "*", "?", "/",
|
|
||||||
" ", "$", "!", "'", "\"", ":", "@", "+", "`", "|", "=" };
|
|
||||||
|
|
||||||
private Path mLogDirectory;
|
private Path mLogDirectory;
|
||||||
private String mFileNameSuffix;
|
private String mFileNameSuffix;
|
||||||
@@ -102,7 +98,7 @@ public abstract class EventLogger extends Module
|
|||||||
*/
|
*/
|
||||||
private String replaceIllegalCharacters(String filename)
|
private String replaceIllegalCharacters(String filename)
|
||||||
{
|
{
|
||||||
for( String illegalCharacter: mIllegalCharacters )
|
for(String illegalCharacter : ILLEGAL_FILENAME_CHARACTERS)
|
||||||
{
|
{
|
||||||
filename = filename.replace(illegalCharacter, "_");
|
filename = filename.replace(illegalCharacter, "_");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user