[DEV] udate some log model
This commit is contained in:
parent
5e0fdf1bc8
commit
f2fcd75fb9
@ -24,7 +24,7 @@ public class Ejson {
|
||||
public static void display(final JsonNode root) {
|
||||
final StringBuilder tmpp = new StringBuilder();
|
||||
SerializerJson.serialize(root, tmpp, 0);
|
||||
Log.info("Generated JSON : \n" + tmpp.toString());
|
||||
Log.info("Generated JSON : \n{}", tmpp.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -51,7 +51,7 @@ public class Ejson {
|
||||
property.setDisplayError(true);
|
||||
final byte[] elemData = Uri.getAllData(data);
|
||||
if (elemData == null) {
|
||||
Log.error("Can not read the Stream : " + data);
|
||||
Log.error("Can not read the Stream : {}", data);
|
||||
return null;
|
||||
}
|
||||
final String dataToParse = new String(elemData);
|
||||
|
@ -16,7 +16,7 @@ public class ParseJson {
|
||||
|
||||
boolean iParseArray(final Object parent, final String data, final PositionParsing pos, final FilePos filePos, final ParsingProperty parsingProperty) throws Exception {
|
||||
for (int iii = pos.value + 1; iii < data.length(); iii++) {
|
||||
//Log.verbose("parse Array: '" + data.charAt(iii) + "'");
|
||||
//Log.verbose("parse Array: '{}'", data.charAt(iii));
|
||||
filePos.check(data.charAt(iii));
|
||||
if (data.charAt(iii) == ' ' || data.charAt(iii) == '\t' || data.charAt(iii) == '\n' || data.charAt(iii) == '\r') {
|
||||
// white space == > nothing to do ...
|
||||
@ -211,7 +211,7 @@ public class ParseJson {
|
||||
startPos = pos.value;
|
||||
}
|
||||
for (int iii = startPos; iii < data.length(); iii++) {
|
||||
//Log.verbose("parse Object: '" + data.charAt(iii) + "'");
|
||||
//Log.verbose("parse Object: '{}'", data.charAt(iii));
|
||||
filePos.check(data.charAt(iii));
|
||||
final FilePos tmpPos;
|
||||
if (data.charAt(iii) == ' ' || data.charAt(iii) == '\t' || data.charAt(iii) == '\n' || data.charAt(iii) == '\r') {
|
||||
@ -383,9 +383,9 @@ public class ParseJson {
|
||||
String iParseString(final String data, final PositionParsing pos, final FilePos filePos, final ParsingProperty parsingProperty) throws EjsonBuilderException {
|
||||
final Character end = data.charAt(pos.value);
|
||||
boolean backslashPrevious = false;
|
||||
StringBuilder out = new StringBuilder();
|
||||
final StringBuilder out = new StringBuilder();
|
||||
for (int iii = pos.value + 1; iii < data.length(); iii++) {
|
||||
//Log.verbose("parse String: '" + data.charAt(iii) + "'");
|
||||
//Log.verbose("parse String: '{}'", data.charAt(iii));
|
||||
filePos.check(data.charAt(iii));
|
||||
if (data.charAt(iii) == '\\') {
|
||||
if (backslashPrevious) {
|
||||
@ -414,7 +414,7 @@ public class ParseJson {
|
||||
}
|
||||
|
||||
public Object parse(final String data, final ParsingProperty property) throws Exception, EjsonBuilderException, EjsonParserErrorMulti {
|
||||
Log.verbose("Start parsing document (type: string) size=" + data.length());
|
||||
Log.verbose("Start parsing document (type: string) size={}", data.length());
|
||||
// came from char == > force in utf8 ...
|
||||
final FilePos pos = new FilePos(1, 0);
|
||||
final PositionParsing parsePos = new PositionParsing();
|
||||
|
@ -72,7 +72,7 @@ public class ParsingProperty {
|
||||
* @param error The error to display.
|
||||
*/
|
||||
public void displayError(final EjsonParserError error) {
|
||||
Log.error(error.getFilePos() + " " + error.getMessage() + "\n" + error.getDataLine() + "\n" + Tools.createPosPointer(error.getDataLine(), error.getFilePos().getCol()));
|
||||
Log.error("{} {}\n{}\n", error.getFilePos(), error.getMessage(), error.getDataLine(), Tools.createPosPointer(error.getDataLine(), error.getFilePos().getCol()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -106,11 +106,11 @@ public class Tools {
|
||||
*/
|
||||
public static void drawElementParsed(final Character val, final FilePos filePos) {
|
||||
// if (val == '\n') {
|
||||
// Log.debug(filePos + " parse '\\n'");
|
||||
// Log.debug("{} parse '\\n'", filePos);
|
||||
// } else if (val == '\t') {
|
||||
// Log.debug(filePos + " parse '\\t'");
|
||||
// Log.debug("{} parse '\\t'", filePos);
|
||||
// } else {
|
||||
// Log.debug(filePos + " parse '" + val + "'");
|
||||
// Log.debug("{} parse '{}'", filePos, val);
|
||||
// }
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,6 @@ package test.atriasoft.ejson;
|
||||
|
||||
import org.atriasoft.ejson.Ejson;
|
||||
import org.atriasoft.ejson.exception.EjsonBuilderException;
|
||||
import org.atriasoft.ejson.exception.EjsonParserErrorMulti;
|
||||
import org.atriasoft.ejson.model.JsonNode;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
||||
@ -15,7 +14,7 @@ class EjsonLocal {
|
||||
// errorPos : -1 : no error , 1 : parsing error, 2 generation error, 3 comparaison error ????
|
||||
public static void test(final String ref, final String input, final int errorPos) {
|
||||
//doc.setCaseSensitive(!caseInSensitive);
|
||||
Log.verbose("parse : \n" + input);
|
||||
Log.verbose("parse : \n{}", input);
|
||||
JsonNode root = null;
|
||||
try {
|
||||
root = Ejson.parse(input);
|
||||
@ -23,18 +22,6 @@ class EjsonLocal {
|
||||
Assertions.fail("Must have detected an error");
|
||||
return;
|
||||
}
|
||||
} catch (final EjsonParserErrorMulti e) {
|
||||
if (errorPos == 1) {
|
||||
return;
|
||||
}
|
||||
e.printStackTrace();
|
||||
Assertions.fail("Must have NOT detected an error " + e.getMessage());
|
||||
} catch (final EjsonBuilderException e) {
|
||||
if (errorPos == 1) {
|
||||
return;
|
||||
}
|
||||
e.printStackTrace();
|
||||
Assertions.fail("Must have NOT detected an error " + e.getMessage());
|
||||
} catch (final Exception e) {
|
||||
if (errorPos == 1) {
|
||||
return;
|
||||
|
@ -20,51 +20,51 @@ public class Log {
|
||||
private static final boolean PRINT_TODO = Logger.getNeedPrint(LIB_NAME, LogLevel.TODO);
|
||||
private static final boolean PRINT_PRINT = Logger.getNeedPrint(LIB_NAME, LogLevel.PRINT);
|
||||
|
||||
public static void critical(final String data) {
|
||||
public static void critical(final String data, final Object... objects) {
|
||||
if (PRINT_CRITICAL) {
|
||||
Logger.critical(LIB_NAME_DRAW, data);
|
||||
Logger.critical(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void debug(final String data) {
|
||||
public static void debug(final String data, final Object... objects) {
|
||||
if (PRINT_DEBUG) {
|
||||
Logger.debug(LIB_NAME_DRAW, data);
|
||||
Logger.debug(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void error(final String data) {
|
||||
public static void error(final String data, final Object... objects) {
|
||||
if (PRINT_ERROR) {
|
||||
Logger.error(LIB_NAME_DRAW, data);
|
||||
Logger.error(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void info(final String data) {
|
||||
public static void info(final String data, final Object... objects) {
|
||||
if (PRINT_INFO) {
|
||||
Logger.info(LIB_NAME_DRAW, data);
|
||||
Logger.info(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void print(final String data) {
|
||||
public static void print(final String data, final Object... objects) {
|
||||
if (PRINT_PRINT) {
|
||||
Logger.print(LIB_NAME_DRAW, data);
|
||||
Logger.print(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void todo(final String data) {
|
||||
public static void todo(final String data, final Object... objects) {
|
||||
if (PRINT_TODO) {
|
||||
Logger.todo(LIB_NAME_DRAW, data);
|
||||
Logger.todo(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void verbose(final String data) {
|
||||
public static void verbose(final String data, final Object... objects) {
|
||||
if (PRINT_VERBOSE) {
|
||||
Logger.verbose(LIB_NAME_DRAW, data);
|
||||
Logger.verbose(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void warning(final String data) {
|
||||
public static void warning(final String data, final Object... objects) {
|
||||
if (PRINT_WARNING) {
|
||||
Logger.warning(LIB_NAME_DRAW, data);
|
||||
Logger.warning(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user