Skip to content

Commit

Permalink
docs(main): Updated overall Javadoc.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shuvlyy committed Apr 9, 2024
1 parent 008cfed commit bcd8ab3
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 103 deletions.
18 changes: 9 additions & 9 deletions src/fr/hashtek/hashlogger/HashLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public class HashLog
* Creates a new instance of HashLog
* (without exception)
*
* @param instance HashLogger instance
* @param author Log author
* @param logLevel Log's level
* @param log Message to output
* @param instance HashLogger instance
* @param author Log author
* @param logLevel Log's level
* @param log Message to output
*/
public HashLog(HashLoggable instance, HashLoggable author, LogLevel logLevel, String log)
{
Expand All @@ -31,11 +31,11 @@ public HashLog(HashLoggable instance, HashLoggable author, LogLevel logLevel, St
/**
* Creates a new instance of HashLog.
*
* @param instance HashLogger instance
* @param author Log author
* @param logLevel Log's level
* @param log Message to output
* @param exception Exception
* @param instance HashLogger instance
* @param author Log author
* @param logLevel Log's level
* @param log Message to output
* @param exception Exception
*/
public HashLog(HashLoggable instance, HashLoggable author, LogLevel logLevel, String log, Exception exception)
{
Expand Down
107 changes: 27 additions & 80 deletions src/fr/hashtek/hashlogger/HashLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,67 +37,14 @@ public HashLogger(HashLoggable plugin, LogLevel logLevel, List<HashLog> historyH
this.info(this, "HashLogger initialized. Log level: " + this.settings.getLogLevel().getFullName());
}



/*private String createLogOutput(HashLoggable author, LogLevel type, String message)
{
String output = "[" + this.plugin.getClass().getSimpleName();

// output += ": " + author.getClass().getSimpleName();
//
// output += ".java] ";
//
// if (this.showTimestamp) {
// Date date = new Date();
// String formattedDate = new SimpleDateFormat("(MM-dd-yy HH:mm:ss.SSS) ").format(date);
//
// output += formattedDate;
// }
//
// output += type.getColor();
//
// output += "<";
//
// output += this.shortDisplay
// ? type.getShortenedName()
// : type.getFullName();
//
// output += ">";
//
// output += LogLevel.INFO.getColor();
//
// output += " " + message;
return output;
}*/

/**
* Creates a formatted string to output to the console.
* Given exception error message will be outputted.
* This function must be only used for error logs.
* General log (with exception).
*
* @param author Log author
* @param author Log author
* @param type Log level type
* @param message Message to output
* @param exception Raised exception
* @return Formatted String
*/
/*private String createLogOutput(HashLoggable author, LogLevel type, String message, Exception exception)
{
String finalMessage = message;
if (exception != null)
finalMessage += "\n" + exception.getMessage();
return createLogOutput(author, type, finalMessage);
}*/

/**
* General log (with exception).
*
* @param author Log author
* @param type Log level type
* @param message Message to output
* @param exception Raised exception
* @param exception Raised exception
*/
private void log(HashLoggable author, LogLevel type, String message, Exception exception)
{
Expand All @@ -112,9 +59,9 @@ private void log(HashLoggable author, LogLevel type, String message, Exception e
/**
* General log (without exception).
*
* @param author Log author
* @param type Log level type
* @param message Message to output
* @param author Log author
* @param type Log level type
* @param message Message to output
*/
private void log(HashLoggable author, LogLevel type, String message)
{
Expand All @@ -124,8 +71,8 @@ private void log(HashLoggable author, LogLevel type, String message)
/**
* Debugging log.
*
* @param author Log author
* @param message Message to output
* @param author Log author
* @param message Message to output
*/
public void debug(HashLoggable author, String message)
{
Expand All @@ -135,8 +82,8 @@ public void debug(HashLoggable author, String message)
/**
* Information log.
*
* @param author Log author
* @param message Message to output
* @param author Log author
* @param message Message to output
*/
public void info(HashLoggable author, String message)
{
Expand All @@ -146,9 +93,9 @@ public void info(HashLoggable author, String message)
/**
* Error log (with exception).
*
* @param author Log author
* @param message Message to output
* @param exception Raised exception
* @param author Log author
* @param message Message to output
* @param exception Raised exception
*/
public void error(HashLoggable author, String message, Exception exception)
{
Expand All @@ -158,8 +105,8 @@ public void error(HashLoggable author, String message, Exception exception)
/**
* Error log (without exception).
*
* @param author Log author
* @param message Message to output
* @param author Log author
* @param message Message to output
*/
public void error(HashLoggable author, String message)
{
Expand All @@ -169,8 +116,8 @@ public void error(HashLoggable author, String message)
/**
* Warning log.
*
* @param author Log author
* @param message Message to output
* @param author Log author
* @param message Message to output
*/
public void warning(HashLoggable author, String message)
{
Expand All @@ -180,9 +127,9 @@ public void warning(HashLoggable author, String message)
/**
* Critical log (with exception).
*
* @param author Log author
* @param message Message to output
* @param exception Raised exception
* @param author Log author
* @param message Message to output
* @param exception Raised exception
*/
public void critical(HashLoggable author, String message, Exception exception)
{
Expand All @@ -192,8 +139,8 @@ public void critical(HashLoggable author, String message, Exception exception)
/**
* Critical log (without exception).
*
* @param author Log author
* @param message Message to output
* @param author Log author
* @param message Message to output
*/
public void critical(HashLoggable author, String message)
{
Expand All @@ -203,9 +150,9 @@ public void critical(HashLoggable author, String message)
/**
* Fatal log (with exception).
*
* @param author Log author
* @param message Message to output
* @param exception Raised exception
* @param author Log author
* @param message Message to output
* @param exception Raised exception
*/
public void fatal(HashLoggable author, String message, Exception exception)
{
Expand All @@ -215,8 +162,8 @@ public void fatal(HashLoggable author, String message, Exception exception)
/**
* Fatal log (without exception).
*
* @param author Log author
* @param message Message to output
* @param author Log author
* @param message Message to output
*/
public void fatal(HashLoggable author, String message)
{
Expand Down
18 changes: 15 additions & 3 deletions src/fr/hashtek/hashlogger/HashLoggerSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,23 @@ public class HashLoggerSettings
private boolean shortDisplay;


public HashLoggerSettings(LogLevel level)
/**
* Creates a new instance of HashLoggerSettings.
*
* @param logLevel Minimum log level for log to be outputted
*/
public HashLoggerSettings(LogLevel logLevel)
{
this(false, false, level);
this(false, false, logLevel);
}

/**
* Creates a new instance of HashLoggerSettings.
*
* @param showTimestamp Should HashLogger output timestamps?
* @param shortDisplay Should HashLogger use short names?
* @param logLevel Minimum log level for log to be outputted
*/
public HashLoggerSettings(boolean showTimestamp, boolean shortDisplay, LogLevel logLevel)
{
this.showTimestamp = showTimestamp;
Expand All @@ -31,7 +43,7 @@ public boolean doesShowTimestamp()
}

/**
* @return Does logger logs shortly
* @return Does logger use short names
*/
public boolean doesDisplayShortly()
{
Expand Down
11 changes: 0 additions & 11 deletions src/fr/hashtek/hashlogger/LogLevel.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ public enum LogLevel


/**
* Returns the full name of the log level.
*
* @return Log level's full name
*/
public String getFullName()
Expand All @@ -47,8 +45,6 @@ public String getFullName()
}

/**
* Returns the shortened name of the log level.
*
* @return Log level's shortened name
*/
public String getShortName()
Expand All @@ -57,8 +53,6 @@ public String getShortName()
}

/**
* Returns the color of the log level.
*
* @return Log level's color
*/
public String getColor()
Expand All @@ -67,8 +61,6 @@ public String getColor()
}

/**
* Returns the Minecraft color of the log level.
*
* @return Log level's Minecraft color
*/
public String getMinecraftColor()
Expand All @@ -77,9 +69,6 @@ public String getMinecraftColor()
}

/**
* Returns true if the log level aims to be in
* error output.
*
* @return Is in system error output ?
*/
public boolean isInSysErr()
Expand Down

0 comments on commit bcd8ab3

Please sign in to comment.