444 Expose Application Directories via User Preferences (#458)

* Refactors DirectoryPreference from PLaylistPreference.
Adds editor to PreferenceEditor for directories.
Organizes preference editor tree.

* Adds recording directory preference to editor and updates recording
manager to dynamically use this property for recordings.

* Adds event logs directory preference to editor and updates event log
manager to dynamically use this property for event logging.

* Adds application log directory preference.  Updates logging to use user
preference for application log directory.  Moves logging initialization
into the main application class and removes file based logging configs
from the logback.xml configuration file.

* Refactors application logging into its own class and adds prefeence
update monitoring to dynamically stop/start the logger in the new
directory location.

* Adds streaming and screen capture directories to the user preferences
editor and updates streaming and screen captures to dynamically adapt
to user changes.
This commit is contained in:
Denny Sheirer
2018-12-27 06:12:03 -05:00
committed by GitHub
parent 5b5a1431b4
commit 347a71f097
23 changed files with 1491 additions and 253 deletions

View File

@@ -22,7 +22,7 @@ package io.github.dsheirer.module.log;
import io.github.dsheirer.controller.channel.Channel;
import io.github.dsheirer.module.Module;
import io.github.dsheirer.module.log.config.EventLogConfiguration;
import io.github.dsheirer.properties.SystemProperties;
import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.source.config.SourceConfigTuner;
import io.github.dsheirer.util.StringUtils;
import org.slf4j.Logger;
@@ -36,12 +36,11 @@ public class EventLogManager
{
private final static Logger mLog = LoggerFactory.getLogger(EventLogManager.class);
private Path mDirectory;
private UserPreferences mUserPreferences;
public EventLogManager()
public EventLogManager(UserPreferences userPreferences)
{
mDirectory = SystemProperties.getInstance()
.getApplicationFolder("event_logs");
mUserPreferences = userPreferences;
}
public List<Module> getLoggers(Channel channel)
@@ -89,16 +88,18 @@ public class EventLogManager
sb.append(eventLogType.getFileSuffix());
sb.append(".log");
Path eventLogDirectory = mUserPreferences.getDirectoryPreference().getDirectoryEventLog();
switch(eventLogType)
{
case CALL_EVENT:
return new DecodeEventLogger(mDirectory, sb.toString(), frequency);
return new DecodeEventLogger(eventLogDirectory, sb.toString(), frequency);
case DECODED_MESSAGE:
return new MessageEventLogger(mDirectory, sb.toString(), MessageEventLogger.Type.DECODED, frequency);
return new MessageEventLogger(eventLogDirectory, sb.toString(), MessageEventLogger.Type.DECODED, frequency);
case TRAFFIC_CALL_EVENT:
return new DecodeEventLogger(mDirectory, sb.toString(), frequency);
return new DecodeEventLogger(eventLogDirectory, sb.toString(), frequency);
case TRAFFIC_DECODED_MESSAGE:
return new MessageEventLogger(mDirectory, sb.toString(), MessageEventLogger.Type.DECODED, frequency);
return new MessageEventLogger(eventLogDirectory, sb.toString(), MessageEventLogger.Type.DECODED, frequency);
default:
return null;
}