|
@@ -48,7 +48,6 @@ import com.dmdirc.events.ChannelTopicChangeEvent;
|
48
|
48
|
import com.dmdirc.events.ClientPrefsOpenedEvent;
|
49
|
49
|
import com.dmdirc.events.QueryClosedEvent;
|
50
|
50
|
import com.dmdirc.events.QueryOpenedEvent;
|
51
|
|
-import com.dmdirc.events.UserErrorEvent;
|
52
|
51
|
import com.dmdirc.interfaces.GroupChat;
|
53
|
52
|
import com.dmdirc.interfaces.GroupChatUser;
|
54
|
53
|
import com.dmdirc.interfaces.PrivateChat;
|
|
@@ -56,7 +55,6 @@ import com.dmdirc.interfaces.User;
|
56
|
55
|
import com.dmdirc.interfaces.WindowModel;
|
57
|
56
|
import com.dmdirc.interfaces.config.AggregateConfigProvider;
|
58
|
57
|
import com.dmdirc.interfaces.config.ConfigChangeListener;
|
59
|
|
-import com.dmdirc.logger.ErrorLevel;
|
60
|
58
|
import com.dmdirc.plugins.PluginDomain;
|
61
|
59
|
import com.dmdirc.plugins.PluginInfo;
|
62
|
60
|
import com.dmdirc.ui.WindowManager;
|
|
@@ -89,14 +87,20 @@ import javax.inject.Inject;
|
89
|
87
|
import javax.inject.Provider;
|
90
|
88
|
import javax.inject.Singleton;
|
91
|
89
|
|
|
90
|
+import org.slf4j.Logger;
|
|
91
|
+import org.slf4j.LoggerFactory;
|
|
92
|
+
|
92
|
93
|
import net.engio.mbassy.listener.Handler;
|
93
|
94
|
|
|
95
|
+import static com.dmdirc.util.LogUtils.USER_ERROR;
|
|
96
|
+
|
94
|
97
|
/**
|
95
|
98
|
* Manages logging activities.
|
96
|
99
|
*/
|
97
|
100
|
@Singleton
|
98
|
101
|
public class LoggingManager implements ConfigChangeListener {
|
99
|
102
|
|
|
103
|
+ private static final Logger LOG = LoggerFactory.getLogger(LoggingManager.class);
|
100
|
104
|
/** Date format used for "File Opened At" log. */
|
101
|
105
|
private static final DateFormat OPENED_AT_FORMAT = new SimpleDateFormat(
|
102
|
106
|
"EEEE MMMM dd, yyyy - HH:mm:ss");
|
|
@@ -153,13 +157,11 @@ public class LoggingManager implements ConfigChangeListener {
|
153
|
157
|
final File dir = new File(directoryProvider.get());
|
154
|
158
|
if (dir.exists()) {
|
155
|
159
|
if (!dir.isDirectory()) {
|
156
|
|
- eventBus.publishAsync(new UserErrorEvent(ErrorLevel.LOW, null,
|
157
|
|
- "Unable to create logging dir (file exists instead)", ""));
|
|
160
|
+ LOG.info(USER_ERROR, "Unable to create logging dir (file exists instead)");
|
158
|
161
|
}
|
159
|
162
|
} else {
|
160
|
163
|
if (!dir.mkdirs()) {
|
161
|
|
- eventBus.publishAsync(new UserErrorEvent(ErrorLevel.LOW, null,
|
162
|
|
- "Unable to create logging dir", ""));
|
|
164
|
+ LOG.info(USER_ERROR, "Unable to create logging dir");
|
163
|
165
|
}
|
164
|
166
|
}
|
165
|
167
|
|
|
@@ -402,7 +404,7 @@ public class LoggingManager implements ConfigChangeListener {
|
402
|
404
|
*/
|
403
|
405
|
protected void showBackBuffer(final WindowModel frame, final String filename) {
|
404
|
406
|
if (frame == null) {
|
405
|
|
- eventBus.publishAsync(new UserErrorEvent(ErrorLevel.LOW, null, "Given a null frame", ""));
|
|
407
|
+ LOG.info(USER_ERROR, "Unable to show back buffer, frame was null");
|
406
|
408
|
return;
|
407
|
409
|
}
|
408
|
410
|
|
|
@@ -421,9 +423,8 @@ public class LoggingManager implements ConfigChangeListener {
|
421
|
423
|
file.close();
|
422
|
424
|
frame.addLine(getColouredString(colour, "--- End of backbuffer\n"));
|
423
|
425
|
} catch (IOException | SecurityException e) {
|
424
|
|
- eventBus.publishAsync(new UserErrorEvent(ErrorLevel.LOW, e,
|
425
|
|
- "Unable to show backbuffer (Filename: " + filename + "): " + e.getMessage(),
|
426
|
|
- ""));
|
|
426
|
+ LOG.info(USER_ERROR, "Unable to show backbuffer (Filename: {}): {}", filename,
|
|
427
|
+ e.getMessage(), e);
|
427
|
428
|
}
|
428
|
429
|
}
|
429
|
430
|
}
|