LogX 1.0

Download

What is LogX?

LogX is a Java-based logging utility libary.Its was designed and written by Andy Hsieh in 2018.

LogX was designed to save message to database or specific file.
For this goal , you can extend LogX to save message to your database.

LogX log message by content type.
Its good for search specific message.
License

MIT
Start

HelloLogX.java
package example.logx;

import com.cenux.logx.core.LogX;

public class HelloLogX {
	
	public static void main(String[] args) {
		LogX logx = new LogX();
		
		logx.info("Hello LogX");
		
		logx.end();
	}
}

You would get log like this.
2020-02-03 17:13:07.610 1 LogX[example.logx.HelloLogX.main] #-START-/
2020-02-03 17:13:07.644 1 LogX[example.logx.HelloLogX.main] *-INFO-/ Hello LogX
2020-02-03 17:13:07.644 1 LogX[example.logx.HelloLogX.main] #-END-/ Cost milli:34
Methods
AllLogX.java
package example.logx;

import com.cenux.logx.core.LogX;

public class AllLogX {
	public static void main(String[] args) {
		LogX logx = new LogX();
		
		// /// flow methods
		logx.ui("User interface message...");
		logx.controller("Controller message...");
		logx.action("Action message...");
		logx.service("Service message...");
		logx.fun("Function message...");
		logx.core("Core message...");
		logx.sys("System message...");
		
		try {
			// /// information methods
			logx.info("Info message...");
			logx.keypoint("Keypoint message...");
			if (true) {
				logx.event("0000");
			}
			
			// /// variable methods
			int year = 2020;
			logx.variable("year", year);
			
			String name = "Andy";
			logx.variable("name", name);
			
			// /// debug methods
			logx.debug("Debug message...");
			logx.warning("Warning message...");
			logx.fatal("Fatal message...");
			
			if (true) {
				throw new Exception("Test...");
			}
		} catch (Exception e) {
			logx.exception(e);
		} catch (Error e) {
			logx.error(e);
		}
		
		logx.end();
	}
}

You would get log like this.
2020-02-03 17:13:49.335 1 LogX[example.logx.AllLogX.main] #-START-/
2020-02-03 17:13:49.353 1 LogX[example.logx.AllLogX.main] #-UI-/ User interface message...
2020-02-03 17:13:49.354 1 LogX[example.logx.AllLogX.main] #-CONTROLLER-/ Controller message...
2020-02-03 17:13:49.354 1 LogX[example.logx.AllLogX.main] #-ACTION-/ Action message...
2020-02-03 17:13:49.355 1 LogX[example.logx.AllLogX.main] #-SERVICE-/ Service message...
2020-02-03 17:13:49.355 1 LogX[example.logx.AllLogX.main] #-FUN-/ Function message...
2020-02-03 17:13:49.355 1 LogX[example.logx.AllLogX.main] #-CORE-/ Core message...
2020-02-03 17:13:49.355 1 LogX[example.logx.AllLogX.main] #-SYS-/ System message...
2020-02-03 17:13:49.356 1 LogX[example.logx.AllLogX.main] *-INFO-/ Info message...
2020-02-03 17:13:49.356 1 LogX[example.logx.AllLogX.main] *-KEYPOINT-/ Keypoint message...
2020-02-03 17:13:49.356 1 LogX[example.logx.AllLogX.main] *-EVENT-/ 0000
2020-02-03 17:13:49.356 1 LogX[example.logx.AllLogX.main] $-VARIABLE-/ year=2020
2020-02-03 17:13:49.356 1 LogX[example.logx.AllLogX.main] $-VARIABLE-/ name=Andy
2020-02-03 17:13:49.357 1 LogX[example.logx.AllLogX.main] !-DEBUG-/ Debug message...
2020-02-03 17:13:49.357 1 LogX[example.logx.AllLogX.main] !-WARNING-/ Warning message...
2020-02-03 17:13:49.357 1 LogX[example.logx.AllLogX.main] !-FATAL-/ Fatal message...
2020-02-03 17:13:49.357 1 LogX[example.logx.AllLogX.main] !-EXCEPTION-/ 
java.lang.Exception: Test...
	at example.logx.AllLogX.main(AllLogX.java:39)
2020-02-03 17:13:49.357 1 LogX[example.logx.AllLogX.main] #-END-/ Cost milli:22
Constructor

LogX has follow constructors , you can turn off log by flag.
LogX() // default show all
LogX(boolean SHOW_TIME_FLAG) // time and thread id
LogX(boolean SHOW_FLAG,boolean SHOW_TRACE_FLAG,boolean SHOW_TIME_FLAG)

LogX logx = new LogX(false,false,flase); // its would log nothing
History
2018-11-09 LogX created.
2020-02-03 LogX 1.0 release.