22 package com.realtime.crossfire.jxclient.window;
30 import java.io.FileOutputStream;
31 import java.io.IOException;
32 import java.io.OutputStreamWriter;
33 import java.text.SimpleDateFormat;
34 import java.util.Date;
35 import org.jetbrains.annotations.NotNull;
36 import org.jetbrains.annotations.Nullable;
48 private final SimpleDateFormat
format =
new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss ");
65 @SuppressWarnings(
"FieldCanBeLocal")
73 @SuppressWarnings("FieldCanBeLocal")
77 public void commandDrawextinfoReceived(
final int color,
final int type,
final int subtype, @NotNull
final String message) {
82 public void setDebugMode(
final boolean printMessageTypes) {
93 @SuppressWarnings(
"FieldCanBeLocal")
122 private void log(@NotNull
final String message) {
127 final Date now =
new Date();
130 try (
final FileOutputStream fos =
new FileOutputStream(file,
true)) {
131 try (
final OutputStreamWriter osw =
new OutputStreamWriter(fos)) {
132 osw.write(
format.format(now)+message+
"\n");
135 }
catch (
final IOException ex) {
136 System.err.println(ex.getMessage());
Utility class to return references to settings files.
Interface for listeners interested in drawinfo messages received from the Crossfire server...
final CrossfireDrawextinfoListener crossfireDrawextinfoListener
The CrossfireDrawextinfoListener registered to receive drawextinfo commands.
final CrossfireQueryListener crossfireQueryListener
The CrossfireQueryListener registered to receive query commands.
final CrossfireDrawinfoListener crossfireDrawinfoListener
The CrossfireDrawinfoListener registered to receive drawinfo commands.
void setHostname(@Nullable final String hostname)
Updates the hostname.
final boolean enabled
Whether the message logger is enabled.
static File getMessageLogFile(@Nullable final String hostname)
Returns the log file for text message logging.
Interface for listeners interested in drawextinfo messages received from the Crossfire server...
final SimpleDateFormat format
The format for writing timestamps.
Logs received messages to a file.
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
Interface for listeners interested in query messages received from the Crossfire server.
void log(@NotNull final String message)
Adds a message to the log file.
String hostname
The hostname.