Merge branch 'develop' into f/javadoc

This commit is contained in:
delvh 2019-12-20 12:58:06 +01:00 committed by GitHub
commit 95fa3a539f
10 changed files with 279 additions and 222 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
/target/ /target/
/localDB/ /localDB/
/themes.ser /log/
/themes.ser

View File

@ -18,6 +18,7 @@ import javax.xml.datatype.DatatypeFactory;
import envoy.client.event.EventBus; import envoy.client.event.EventBus;
import envoy.client.event.MessageCreationEvent; import envoy.client.event.MessageCreationEvent;
import envoy.client.util.EnvoyLog;
import envoy.exception.EnvoyException; import envoy.exception.EnvoyException;
import envoy.schema.Message; import envoy.schema.Message;
import envoy.schema.Message.Metadata.MessageState; import envoy.schema.Message.Metadata.MessageState;
@ -48,7 +49,7 @@ public class LocalDB {
private Sync sync = objectFactory.createSync(); private Sync sync = objectFactory.createSync();
private Sync readMessages = objectFactory.createSync(); private Sync readMessages = objectFactory.createSync();
private static final Logger logger = Logger.getLogger(LocalDB.class.getSimpleName()); private static final Logger logger = EnvoyLog.getLogger(LocalDB.class.getSimpleName());
/** /**
* Constructs an empty local database. To serialize any chats to the file * Constructs an empty local database. To serialize any chats to the file

View File

@ -114,7 +114,7 @@ public class Settings {
} }
/** /**
* @return the name of the current Theme * @return the name of the current theme
* @since Envoy v0.2-alpha * @since Envoy v0.2-alpha
*/ */
public String getCurrentTheme() { return currentTheme; } public String getCurrentTheme() { return currentTheme; }
@ -122,7 +122,7 @@ public class Settings {
/** /**
* Sets the currentTheme * Sets the currentTheme
* *
* @param themeName the name of the current theme * @param themeName the name of the new current theme
* @since Envoy v0.2-alpha * @since Envoy v0.2-alpha
*/ */
public void setCurrentTheme(String themeName) { currentTheme = themeName; } public void setCurrentTheme(String themeName) { currentTheme = themeName; }

View File

@ -16,3 +16,4 @@ public interface Event<T> {
*/ */
T get(); T get();
} }

View File

@ -30,8 +30,10 @@ import envoy.client.Client;
import envoy.client.Config; import envoy.client.Config;
import envoy.client.LocalDB; import envoy.client.LocalDB;
import envoy.client.Settings; import envoy.client.Settings;
import envoy.client.util.EnvoyLog;
import envoy.client.event.EventBus; import envoy.client.event.EventBus;
import envoy.client.event.ThemeChangeEvent; import envoy.client.event.ThemeChangeEvent;
import envoy.schema.Message; import envoy.schema.Message;
import envoy.schema.User; import envoy.schema.User;
@ -66,7 +68,7 @@ public class ChatWindow extends JFrame {
private static int space = 4; private static int space = 4;
private static final Logger logger = Logger.getLogger(ChatWindow.class.getSimpleName()); private static final Logger logger = EnvoyLog.getLogger(ChatWindow.class.getSimpleName());
public ChatWindow(Client client, LocalDB localDB) { public ChatWindow(Client client, LocalDB localDB) {
this.client = client; this.client = client;
@ -167,9 +169,9 @@ public class ChatWindow extends JFrame {
settingsButton.addActionListener((evt) -> { settingsButton.addActionListener((evt) -> {
try { try {
SettingsScreen.open(); new SettingsScreen().setVisible(true);
changeChatWindowColors(Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()));
} catch (Exception e) { } catch (Exception e) {
SettingsScreen.open();
logger.log(Level.WARNING, "An error occured while opening the settings screen", e); logger.log(Level.WARNING, "An error occured while opening the settings screen", e);
e.printStackTrace(); e.printStackTrace();
} }
@ -236,7 +238,8 @@ public class ChatWindow extends JFrame {
/** /**
* Used to immediately reload the ChatWindow when settings were changed. * Used to immediately reload the ChatWindow when settings were changed.
* *
* @param theme the theme to change colors into
* @since Envoy v0.1-alpha * @since Envoy v0.1-alpha
*/ */
private void changeChatWindowColors(Theme theme) { private void changeChatWindowColors(Theme theme) {

View File

@ -11,6 +11,7 @@ import java.awt.Insets;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.Arrays; import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
@ -25,8 +26,8 @@ import javax.swing.JPanel;
import javax.swing.JTextPane; import javax.swing.JTextPane;
import javax.swing.ListSelectionModel; import javax.swing.ListSelectionModel;
import envoy.client.LocalDB;
import envoy.client.Settings; import envoy.client.Settings;
import envoy.client.util.EnvoyLog;
import envoy.client.event.EventBus; import envoy.client.event.EventBus;
import envoy.client.event.ThemeChangeEvent; import envoy.client.event.ThemeChangeEvent;
@ -56,44 +57,23 @@ public class SettingsScreen extends JDialog {
private GridBagConstraints gbc_themeContent = new GridBagConstraints(); private GridBagConstraints gbc_themeContent = new GridBagConstraints();
private Theme selectedTheme = Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()); private JButton createNewThemeButton = new JButton("Create New Theme");
private JPanel colorsPanel = new JPanel();
private JButton okButton = new JButton("Save");
private JButton cancelButton = new JButton("Cancel");
private JButton createNewThemeButton = new JButton("Create New Theme");
private JPanel colorsPanel = new JPanel();
private JButton okButton = new JButton("Save");
private JButton cancelButton = new JButton("Cancel");
private static int space = 5; private static int space = 5;
private Theme temporaryTheme; private Theme temporaryTheme, selectedTheme;
private static final Logger logger = Logger.getLogger(LocalDB.class.getSimpleName()); private static final Logger logger = EnvoyLog.getLogger(SettingsScreen.class.getSimpleName());
private static SettingsScreen settingsScreen;
// TODO: Add a JPanel with all the Information necessary:
// change (Picture,Username, Email, Password) and toggle(light/dark mode,
// "ctrl+enter"/"enter"
// to send a message directly)
/**
* Opens the settings screen.<br>
*
* @since Envoy v0.1-alpha
*/
public static void open() {
settingsScreen = new SettingsScreen();
settingsScreen.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
settingsScreen.setModal(true);
settingsScreen.setVisible(true);
}
/** /**
* Builds the settings screen. * Builds the settings screen.
* *
* @since Envoy v0.1-alpha * @since Envoy v0.1-alpha
*/ */
private SettingsScreen() { public SettingsScreen() {
logger.info(Settings.getInstance().getCurrentTheme()); logger.info(Settings.getInstance().getCurrentTheme());
setBounds(10, 10, 450, 650); setBounds(10, 10, 450, 650);
@ -122,7 +102,7 @@ public class SettingsScreen extends JDialog {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final JList<String> selectedOption = (JList<String>) listSelectionEvent.getSource(); final JList<String> selectedOption = (JList<String>) listSelectionEvent.getSource();
final String option = selectedOption.getSelectedValue(); final String option = selectedOption.getSelectedValue();
System.out.println(option); logger.log(Level.FINEST, option);
switch (option) { switch (option) {
case "Color Themes": case "Color Themes":
@ -173,7 +153,7 @@ public class SettingsScreen extends JDialog {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
String selectedValue = (String) themes.getSelectedItem(); String selectedValue = (String) themes.getSelectedItem();
System.out.println(selectedValue); logger.log(Level.FINEST, selectedValue);
selectedTheme = Settings.getInstance().getThemes().get(selectedValue); selectedTheme = Settings.getInstance().getThemes().get(selectedValue);
} }
}); });
@ -229,7 +209,7 @@ public class SettingsScreen extends JDialog {
createNewThemeButton.addActionListener((evt) -> { createNewThemeButton.addActionListener((evt) -> {
try { try {
String s = JOptionPane.showInputDialog("Enter a name for the new theme"); String s = JOptionPane.showInputDialog("Enter a name for the new theme");
System.out.println(s); logger.log(Level.FINEST, s);
Settings.getInstance() Settings.getInstance()
.addNewThemeToMap(new Theme(s, temporaryTheme.getBackgroundColor(), temporaryTheme.getCellColor(), .addNewThemeToMap(new Theme(s, temporaryTheme.getBackgroundColor(), temporaryTheme.getCellColor(),
temporaryTheme.getInteractableForegroundColor(), temporaryTheme.getInteractableBackgroundColor(), temporaryTheme.getInteractableForegroundColor(), temporaryTheme.getInteractableBackgroundColor(),
@ -295,7 +275,7 @@ public class SettingsScreen extends JDialog {
Settings.getInstance().setEnterToSend(Settings.getInstance().isEnterToSend());// still temporary Settings.getInstance().setEnterToSend(Settings.getInstance().isEnterToSend());// still temporary
Settings.getInstance().setCurrentTheme(selectedTheme.getThemeName()); Settings.getInstance().setCurrentTheme(selectedTheme.getThemeName());
System.out.println(selectedTheme.getThemeName()); logger.log(Level.FINER, selectedTheme.getThemeName());
final Theme currentTheme = Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()); final Theme currentTheme = Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme());
changeSettingsScreenColors(currentTheme); changeSettingsScreenColors(currentTheme);
@ -306,13 +286,18 @@ public class SettingsScreen extends JDialog {
revalidate(); revalidate();
repaint(); repaint();
} catch (Exception e) { } catch (Exception e) {
logger.info("Something went wrong when changing the setting"); logger.warning("Something went wrong when changing the setting");
settingsScreen.dispose(); JOptionPane.showMessageDialog(this, "Something went wrong when changing the setting");
dispose();
} }
}); });
} }
} }
changeSettingsScreenColors(Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme())); changeSettingsScreenColors(Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()));
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setModal(true);
} }
private void changeSettingsScreenColors(Theme theme) { private void changeSettingsScreenColors(Theme theme) {
@ -447,8 +432,7 @@ public class SettingsScreen extends JDialog {
try { try {
Color newColor = JColorChooser.showDialog(null, "Choose a color", color); Color newColor = JColorChooser.showDialog(null, "Choose a color", color);
if (newColor.getRGB() != color.getRGB()) { if (newColor.getRGB() != color.getRGB()) {
System.out.println("New Color"); logger.log(Level.FINEST, "New Color: " + String.valueOf(color.getRGB()));
System.out.println(color.getRGB());
// TODO: When Theme changed in same settings screen, color variable doesnt // TODO: When Theme changed in same settings screen, color variable doesnt
// update. // update.
temporaryTheme.setColor(yIndex, newColor); temporaryTheme.setColor(yIndex, newColor);

View File

@ -11,6 +11,7 @@ import javax.swing.JOptionPane;
import envoy.client.Client; import envoy.client.Client;
import envoy.client.Config; import envoy.client.Config;
import envoy.client.LocalDB; import envoy.client.LocalDB;
import envoy.client.util.EnvoyLog;
import envoy.exception.EnvoyException; import envoy.exception.EnvoyException;
import envoy.schema.User; import envoy.schema.User;
@ -28,11 +29,9 @@ import envoy.schema.User;
*/ */
public class Startup { public class Startup {
private static final Logger logger = Logger.getLogger(Startup.class.getSimpleName()); private static final Logger logger = EnvoyLog.getLogger(Startup.class.getSimpleName());
public static void main(String[] args) { public static void main(String[] args) {
logger.setLevel(Level.ALL);
Config config = Config.getInstance(); Config config = Config.getInstance();
try { try {
@ -57,7 +56,7 @@ public class Startup {
logger.severe("User name is not set or empty. Exiting..."); logger.severe("User name is not set or empty. Exiting...");
System.exit(1); System.exit(1);
} }
// Initialize the local database // Initialize the local database
LocalDB localDB; LocalDB localDB;
try { try {
@ -81,19 +80,18 @@ public class Startup {
// Try entering offline mode // Try entering offline mode
localDB.loadUsers(); localDB.loadUsers();
User clientUser = localDB.getUsers().get(userName); User clientUser = localDB.getUsers().get(userName);
if(clientUser == null) if (clientUser == null) throw new EnvoyException("Could not enter offline mode: user name unknown");
throw new EnvoyException("Could not enter offline mode: user name unknown");
client.setSender(clientUser); client.setSender(clientUser);
} catch(Exception e2) { } catch (Exception e2) {
JOptionPane.showMessageDialog(null, e2.toString(), "Client error", JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, e2.toString(), "Client error", JOptionPane.ERROR_MESSAGE);
System.exit(1); System.exit(1);
return; return;
} }
} }
// Set client user in local database // Set client user in local database
localDB.setUser(client.getSender()); localDB.setUser(client.getSender());
// Initialize chats in local database // Initialize chats in local database
try { try {
localDB.initializeDBFile(); localDB.initializeDBFile();
@ -105,13 +103,12 @@ public class Startup {
"Local DB error", "Local DB error",
JOptionPane.WARNING_MESSAGE); JOptionPane.WARNING_MESSAGE);
} }
logger.info("Client user ID: " + client.getSender().getID()); logger.info("Client user ID: " + client.getSender().getID());
// Save all users to the local database // Save all users to the local database
if(client.isOnline()) if (client.isOnline()) localDB.setUsers(client.getUsers());
localDB.setUsers(client.getUsers());
EventQueue.invokeLater(() -> { EventQueue.invokeLater(() -> {
try { try {
ChatWindow chatWindow = new ChatWindow(client, localDB); ChatWindow chatWindow = new ChatWindow(client, localDB);
@ -119,7 +116,7 @@ public class Startup {
try { try {
new StatusTrayIcon(chatWindow).show(); new StatusTrayIcon(chatWindow).show();
// If the tray icon is supported, hide the chat window on close // If the tray icon is supported, hide the chat window on close
chatWindow.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); chatWindow.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
} catch (EnvoyException e) { } catch (EnvoyException e) {

View File

@ -1,161 +1,161 @@
package envoy.client.ui; package envoy.client.ui;
import java.awt.Color; import java.awt.Color;
import java.io.Serializable; import java.io.Serializable;
/** /**
* Project: <strong>envoy-client</strong><br> * Project: <strong>envoy-client</strong><br>
* File: <strong>Theme.java</strong><br> * File: <strong>Theme.java</strong><br>
* Created: <strong>23 Nov 2019</strong><br> * Created: <strong>23 Nov 2019</strong><br>
* *
* @author Maximilian K&auml;fer * @author Maximilian K&auml;fer
* @since Envoy v0.2-alpha * @since Envoy v0.2-alpha
*/ */
public class Theme implements Serializable { public class Theme implements Serializable {
private static final long serialVersionUID = 141727847527060352L; private static final long serialVersionUID = 141727847527060352L;
private String themeName; private String themeName;
private Color backgroundColor; private Color backgroundColor;
private Color cellColor; private Color cellColor;
private Color interactableBackgroundColor; private Color interactableBackgroundColor;
private Color userNameColor; private Color userNameColor;
private Color interactableForegroundColor; private Color interactableForegroundColor;
private Color messageColorChat; private Color messageColorChat;
private Color dateColorChat; private Color dateColorChat;
private Color selectionColor; private Color selectionColor;
private Color typingMessageColor; private Color typingMessageColor;
public Theme(String themeName, Color backgroundColor, Color cellColor, Color interactableForegroundColor, Color interactableBackgroundColor, public Theme(String themeName, Color backgroundColor, Color cellColor, Color interactableForegroundColor, Color interactableBackgroundColor,
Color messageColorChat, Color dateColorChat, Color selectionColor, Color typingMessageColor, Color userNameColor) { Color messageColorChat, Color dateColorChat, Color selectionColor, Color typingMessageColor, Color userNameColor) {
this.themeName = themeName; this.themeName = themeName;
this.backgroundColor = backgroundColor; this.backgroundColor = backgroundColor;
this.cellColor = cellColor; this.cellColor = cellColor;
this.interactableForegroundColor = interactableForegroundColor; this.interactableForegroundColor = interactableForegroundColor;
this.interactableBackgroundColor = interactableBackgroundColor; this.interactableBackgroundColor = interactableBackgroundColor;
this.messageColorChat = messageColorChat; this.messageColorChat = messageColorChat;
this.dateColorChat = dateColorChat; this.dateColorChat = dateColorChat;
this.selectionColor = selectionColor; this.selectionColor = selectionColor;
this.typingMessageColor = typingMessageColor; this.typingMessageColor = typingMessageColor;
this.userNameColor = userNameColor; this.userNameColor = userNameColor;
} }
public Theme(String name, Theme other) { public Theme(String name, Theme other) {
this(name, other.backgroundColor, other.cellColor, other.interactableForegroundColor, this(name, other.backgroundColor, other.cellColor, other.interactableForegroundColor,
other.interactableBackgroundColor, other.messageColorChat, other.dateColorChat, other.selectionColor, other.interactableBackgroundColor, other.messageColorChat, other.dateColorChat, other.selectionColor,
other.typingMessageColor, other.userNameColor); other.typingMessageColor, other.userNameColor);
} }
/** /**
* @return name of the theme * @return name of the theme
* @since Envoy v0.2-alpha * @since Envoy v0.2-alpha
*/ */
public String getThemeName() { return themeName; } public String getThemeName() { return themeName; }
/** /**
* @return interactableForegroundColor * @return interactableForegroundColor
* @since Envoy v0.2-alpha * @since Envoy v0.2-alpha
*/ */
public Color getInteractableForegroundColor() { return interactableForegroundColor; } public Color getInteractableForegroundColor() { return interactableForegroundColor; }
/** /**
* @return messageColorChat * @return messageColorChat
* @since Envoy v0.2-alpha * @since Envoy v0.2-alpha
*/ */
public Color getMessageColorChat() { return messageColorChat; } public Color getMessageColorChat() { return messageColorChat; }
/** /**
* @return dateColorChat * @return dateColorChat
* @since Envoy v0.2-alpha * @since Envoy v0.2-alpha
*/ */
public Color getDateColorChat() { return dateColorChat; } public Color getDateColorChat() { return dateColorChat; }
/** /**
* @return selectionColor * @return selectionColor
* @since Envoy v0.2-alpha * @since Envoy v0.2-alpha
*/ */
public Color getSelectionColor() { return selectionColor; } public Color getSelectionColor() { return selectionColor; }
/** /**
* @return typingMessageColor * @return typingMessageColor
* @since Envoy v0.2-alpha * @since Envoy v0.2-alpha
*/ */
public Color getTypingMessageColor() { return typingMessageColor; } public Color getTypingMessageColor() { return typingMessageColor; }
/** /**
* @return backgroundColor * @return backgroundColor
* @since Envoy v0.2-alpha * @since Envoy v0.2-alpha
*/ */
public Color getBackgroundColor() { return backgroundColor; } public Color getBackgroundColor() { return backgroundColor; }
/** /**
* @return cellColor * @return cellColor
* @since Envoy v0.2-alpha * @since Envoy v0.2-alpha
*/ */
public Color getCellColor() { return cellColor; } public Color getCellColor() { return cellColor; }
/** /**
* @return interactableBackgroundColor * @return interactableBackgroundColor
* @since Envoy v0.2-alpha * @since Envoy v0.2-alpha
*/ */
public Color getInteractableBackgroundColor() { return interactableBackgroundColor; } public Color getInteractableBackgroundColor() { return interactableBackgroundColor; }
/** /**
* @return userNameColor * @return userNameColor
* @since Envoy v0.2-alpha * @since Envoy v0.2-alpha
*/ */
public Color getUserNameColor() { return userNameColor; } public Color getUserNameColor() { return userNameColor; }
/** /**
* Sets the a specific {@link Color} in this theme to a new {@link Color} * Sets the a specific {@link Color} in this theme to a new {@link Color}
* *
* @param index - index of the color </br> * @param index - index of the color </br>
* 0 = backgroundColor </br> * 0 = backgroundColor </br>
* 1 = cellColor </br> * 1 = cellColor </br>
* 2 = interactableForegroundColor </br> * 2 = interactableForegroundColor </br>
* 3 = interactableBackgroundColor </br> * 3 = interactableBackgroundColor </br>
* 4 = messageColorChat </br> * 4 = messageColorChat </br>
* 5 = dateColorChat </br> * 5 = dateColorChat </br>
* 6 = selectionColor </br> * 6 = selectionColor </br>
* 7 = typingMessageColor </br> * 7 = typingMessageColor </br>
* 8 = userNameColor </br> * 8 = userNameColor </br>
* </br> * </br>
* *
* @param newColor - new {@link Color} to be set * @param newColor - new {@link Color} to be set
* @since Envoy 0.2-alpha * @since Envoy 0.2-alpha
*/ */
public void setColor(int index, Color newColor) { public void setColor(int index, Color newColor) {
switch (index) { switch (index) {
case 0: case 0:
this.backgroundColor = newColor; this.backgroundColor = newColor;
break; break;
case 1: case 1:
this.cellColor = newColor; this.cellColor = newColor;
break; break;
case 2: case 2:
this.interactableForegroundColor = newColor; this.interactableForegroundColor = newColor;
break; break;
case 3: case 3:
this.interactableBackgroundColor = newColor; this.interactableBackgroundColor = newColor;
break; break;
case 4: case 4:
this.messageColorChat = newColor; this.messageColorChat = newColor;
break; break;
case 5: case 5:
this.dateColorChat = newColor; this.dateColorChat = newColor;
break; break;
case 6: case 6:
this.selectionColor = newColor; this.selectionColor = newColor;
break; break;
case 7: case 7:
this.typingMessageColor = newColor; this.typingMessageColor = newColor;
break; break;
case 8: case 8:
this.userNameColor = newColor; this.userNameColor = newColor;
break; break;
} }
} }
} }

View File

@ -12,8 +12,8 @@ import envoy.schema.User;
import envoy.schema.User.UserStatus; import envoy.schema.User.UserStatus;
/** /**
* Defines how the {@code UserList} is displayed. * Defines how the {@code UserList} is displayed.<br>
* * <br>
* Project: <strong>envoy-client</strong><br> * Project: <strong>envoy-client</strong><br>
* File: <strong>UserListRenderer.java</strong><br> * File: <strong>UserListRenderer.java</strong><br>
* Created: <strong>12 Oct 2019</strong><br> * Created: <strong>12 Oct 2019</strong><br>

View File

@ -0,0 +1,70 @@
package envoy.client.util;
import java.io.File;
import java.io.IOException;
import java.util.logging.ConsoleHandler;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
/**
* Project: <strong>envoy-client</strong><br>
* File: <strong>EnvoyLogger.java</strong><br>
* Created: <strong>14 Dec 2019</strong><br>
*
* @author Leon Hofmeister
* @since Envoy v0.2-alpha
*/
public class EnvoyLog {
private static Level fileLevelBarrier = Level.CONFIG;
private EnvoyLog() {}
/**
* Creates a {@link Logger} with a specified name
* @param name the name of the {@link Logger} to create
* @return the created {@link Logger}
*/
public static Logger getLogger(String name) {
// Get a logger with the specified name
Logger logger = Logger.getLogger(name);
final String logPath = "log/envoy_user.log";
new File(logPath).getParentFile().mkdirs();
SimpleFormatter formatter = new SimpleFormatter();
try {
FileHandler fh = new FileHandler(logPath);
fh.setLevel(fileLevelBarrier);
fh.setFormatter(formatter);
logger.addHandler(fh);
} catch (SecurityException | IOException e) {
e.printStackTrace();
}
ConsoleHandler ch = new ConsoleHandler();
ch.setLevel(Level.FINEST);
ch.setFormatter(formatter);
logger.addHandler(ch);
return logger;
}
/**
* @return the fileLevelBarrier: The current barrier for writing logs to a file.
* @since Envoy v0.2-alpha
*/
public static Level getFileLevelBarrier() { return fileLevelBarrier; }
/**
* @param fileLevelBarrier the severity below which logRecords will be written
* only to the console. At or above they'll also be
* logged in a file. Can be written either in Digits
* from 0 - 1000 or with the according name of the level
* @since Envoy v0.2-alpha
*/
public static void setFileLevel(String fileLevelBarrier) { EnvoyLog.fileLevelBarrier = Level.parse(fileLevelBarrier); }
}