Skip to content

Commit 75eb5dd

Browse files
committed
2022.6.1-Client(convenient yaml setting file!(already complete))
1 parent 7291440 commit 75eb5dd

File tree

22 files changed

+181
-205
lines changed

22 files changed

+181
-205
lines changed
Binary file not shown.
Binary file not shown.

.gradle/7.4/fileHashes/fileHashes.bin

1000 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
986 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-821 Bytes
Binary file not shown.
Binary file not shown.

build/resources/test/Settings.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ fatal:
1919
console: true
2020
server: true
2121
file:
22-
defaultConsolePath: D:\\Program\\Project\\resources\\app\\Git\\Projects\\Optilog-Client\\src\\test\\resources\\logs
23-
fileName: \%timeLog.log
22+
defaultConsolePath: "D:\\Program\\Project\\resources\\app\\Git\\Projects\\Optilog-Client\\src\\test\\resources\\logs"
23+
fileName: "%timeLog.log"
2424
#Path1: ....
2525
#infoPath:%path1
2626
server:
2727
startClient: true
2828
socketNumber: 65535
29-
host: localhost
29+
host: "localhost"
3030
packing:
31-
packingFormat: \[\%yyyy-\%MM-\%dd|\%HH:\%mm:\%ss(\%SS))\]\[\%class \%method(\%file:\%line)/\%thread ] \%level:\%msg
31+
packingFormat: "[%yyyy-%MM-%dd|%HH:%mm:%ss(%SS))][%class %method(%file:%line)/%thread] %level:%msg"
Binary file not shown.
Binary file not shown.

src/main/java/com/optilog/log/console/Console.java

Lines changed: 120 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
public class Console {
1313
@OnlyInInit
1414
public static void initAppender(Optilog instance) {
15+
1516
if (instance.consoleFileMasterCaution) {
1617
instance.allSetting.fileName = instance.allSetting.fileName.replace("%time", Matcher.quoteReplacement(DateTimeFormatter.ofPattern("yyyy-MM-dd HH-mm-ss").format(LocalDateTime.now())));
1718
//System.out.println(instance + "" + instance.allSetting + instance.allSetting.defaultConsolePath);
@@ -110,140 +111,141 @@ public static void initAppender(Optilog instance) {
110111
throw new RuntimeException(e);
111112
}
112113
}
113-
114-
if (instance.allSetting.infoPath.startsWith("%path") & instance.consoleFileMasterCaution) {
115-
try {
116-
if (instance.allSetting.infoPath.replace("%path", "").equals("1")) {
117-
instance.info = instance.allSetting.Path1;
118-
}
119-
if (instance.allSetting.infoPath.replace("%path", "").equals("2")) {
120-
instance.info = instance.allSetting.Path2;
121-
}
122-
if (instance.allSetting.infoPath.replace("%path", "").equals("3")) {
123-
instance.info = instance.allSetting.Path3;
124-
}
125-
if (instance.allSetting.infoPath.replace("%path", "").equals("4")) {
126-
instance.info = instance.allSetting.Path4;
127-
}
128-
if (instance.allSetting.infoPath.replace("%path", "").equals("5")) {
129-
instance.info = instance.allSetting.Path5;
130-
}
131-
if (instance.info.equals("")) {
132-
System.err.println("Optilog Note: Unexpected error occur when parse infoPath");
133-
instance.allSetting.consoleInfo = false;
134-
}
135-
} catch (NullPointerException e) {
136-
instance.consoleFileMasterCaution = false;
114+
}
115+
116+
if (instance.allSetting.infoPath.startsWith("%path") & instance.consoleFileMasterCaution) {
117+
try {
118+
if (instance.allSetting.infoPath.replace("%path", "").equals("1")) {
119+
instance.info = instance.allSetting.Path1;
120+
}
121+
if (instance.allSetting.infoPath.replace("%path", "").equals("2")) {
122+
instance.info = instance.allSetting.Path2;
123+
}
124+
if (instance.allSetting.infoPath.replace("%path", "").equals("3")) {
125+
instance.info = instance.allSetting.Path3;
126+
}
127+
if (instance.allSetting.infoPath.replace("%path", "").equals("4")) {
128+
instance.info = instance.allSetting.Path4;
129+
}
130+
if (instance.allSetting.infoPath.replace("%path", "").equals("5")) {
131+
instance.info = instance.allSetting.Path5;
132+
}
133+
if (instance.info.equals("")) {
137134
System.err.println("Optilog Note: Unexpected error occur when parse infoPath");
138-
e.printStackTrace();
135+
instance.allSetting.consoleInfo = false;
139136
}
137+
} catch (NullPointerException e) {
138+
instance.consoleFileMasterCaution = false;
139+
System.err.println("Optilog Note: Unexpected error occur when parse infoPath");
140+
e.printStackTrace();
140141
}
141-
if (instance.allSetting.errorPath.startsWith("%path") & instance.consoleFileMasterCaution) {
142-
try {
143-
if (instance.allSetting.errorPath.replace("%path", "").equals("1")) {
144-
instance.error = instance.allSetting.Path1;
145-
}
146-
if (instance.allSetting.errorPath.replace("%path", "").equals("2")) {
147-
instance.error = instance.allSetting.Path2;
148-
}
149-
if (instance.allSetting.errorPath.replace("%path", "").equals("3")) {
150-
instance.error = instance.allSetting.Path3;
151-
}
152-
if (instance.allSetting.errorPath.replace("%path", "").equals("4")) {
153-
instance.error = instance.allSetting.Path4;
154-
}
155-
if (instance.allSetting.errorPath.replace("%path", "").equals("5")) {
156-
instance.error = instance.allSetting.Path5;
157-
}
158-
if (instance.error.equals("")) {
159-
instance.allSetting.consoleError = false;
160-
System.err.println("Optilog Note: Unexpected error occur when parse errorPath");
161-
}
162-
} catch (NullPointerException e) {
163-
instance.consoleFileMasterCaution = false;
142+
}
143+
if (instance.allSetting.errorPath.startsWith("%path") & instance.consoleFileMasterCaution) {
144+
try {
145+
if (instance.allSetting.errorPath.replace("%path", "").equals("1")) {
146+
instance.error = instance.allSetting.Path1;
147+
}
148+
if (instance.allSetting.errorPath.replace("%path", "").equals("2")) {
149+
instance.error = instance.allSetting.Path2;
150+
}
151+
if (instance.allSetting.errorPath.replace("%path", "").equals("3")) {
152+
instance.error = instance.allSetting.Path3;
153+
}
154+
if (instance.allSetting.errorPath.replace("%path", "").equals("4")) {
155+
instance.error = instance.allSetting.Path4;
156+
}
157+
if (instance.allSetting.errorPath.replace("%path", "").equals("5")) {
158+
instance.error = instance.allSetting.Path5;
159+
}
160+
if (instance.error.equals("")) {
161+
instance.allSetting.consoleError = false;
164162
System.err.println("Optilog Note: Unexpected error occur when parse errorPath");
165-
e.printStackTrace();
166163
}
164+
} catch (NullPointerException e) {
165+
instance.consoleFileMasterCaution = false;
166+
System.err.println("Optilog Note: Unexpected error occur when parse errorPath");
167+
e.printStackTrace();
167168
}
168-
if (instance.allSetting.warnPath.startsWith("%path") & instance.consoleFileMasterCaution) {
169-
try {
170-
if (instance.allSetting.warnPath.replace("%path", "").equals("1")) {
171-
instance.warn = instance.allSetting.Path1;
172-
}
173-
if (instance.allSetting.warnPath.replace("%path", "").equals("2")) {
174-
instance.warn = instance.allSetting.Path2;
175-
}
176-
if (instance.allSetting.warnPath.replace("%path", "").equals("3")) {
177-
instance.warn = instance.allSetting.Path3;
178-
}
179-
if (instance.allSetting.warnPath.replace("%path", "").equals("4")) {
180-
instance.warn = instance.allSetting.Path4;
181-
}
182-
if (instance.allSetting.warnPath.replace("%path", "").equals("5")) {
183-
instance.warn = instance.allSetting.Path5;
184-
}
185-
if (instance.warn.equals("")) {
186-
instance.allSetting.consoleWarn = false;
187-
System.err.println("Optilog Note: Unexpected error occur when parse warnPath");
188-
}
189-
} catch (NullPointerException e) {
190-
instance.consoleFileMasterCaution = false;
169+
}
170+
if (instance.allSetting.warnPath.startsWith("%path") & instance.consoleFileMasterCaution) {
171+
try {
172+
if (instance.allSetting.warnPath.replace("%path", "").equals("1")) {
173+
instance.warn = instance.allSetting.Path1;
174+
}
175+
if (instance.allSetting.warnPath.replace("%path", "").equals("2")) {
176+
instance.warn = instance.allSetting.Path2;
177+
}
178+
if (instance.allSetting.warnPath.replace("%path", "").equals("3")) {
179+
instance.warn = instance.allSetting.Path3;
180+
}
181+
if (instance.allSetting.warnPath.replace("%path", "").equals("4")) {
182+
instance.warn = instance.allSetting.Path4;
183+
}
184+
if (instance.allSetting.warnPath.replace("%path", "").equals("5")) {
185+
instance.warn = instance.allSetting.Path5;
186+
}
187+
if (instance.warn.equals("")) {
188+
instance.allSetting.consoleWarn = false;
191189
System.err.println("Optilog Note: Unexpected error occur when parse warnPath");
192190
}
191+
} catch (NullPointerException e) {
192+
instance.consoleFileMasterCaution = false;
193+
System.err.println("Optilog Note: Unexpected error occur when parse warnPath");
193194
}
194-
if (instance.allSetting.debugPath.startsWith("%path") & instance.consoleFileMasterCaution) {
195-
try {
196-
if (instance.allSetting.debugPath.replace("%path", "").equals("1")) {
197-
instance.debug = instance.allSetting.Path1;
198-
}
199-
if (instance.allSetting.debugPath.replace("%path", "").equals("2")) {
200-
instance.debug = instance.allSetting.Path2;
201-
}
202-
if (instance.allSetting.debugPath.replace("%path", "").equals("3")) {
203-
instance.debug = instance.allSetting.Path3;
204-
}
205-
if (instance.allSetting.debugPath.replace("%path", "").equals("4")) {
206-
instance.debug = instance.allSetting.Path4;
207-
}
208-
if (instance.allSetting.debugPath.replace("%path", "").equals("5")) {
209-
instance.debug = instance.allSetting.Path5;
210-
}
211-
if (instance.debug.equals("")) {
212-
instance.allSetting.consoleDebug = false;
213-
System.err.println("Optilog Note: Unexpected error occur when parse debugPath");
214-
}
215-
} catch (NullPointerException e) {
216-
instance.consoleFileMasterCaution = false;
195+
}
196+
if (instance.allSetting.debugPath.startsWith("%path") & instance.consoleFileMasterCaution) {
197+
try {
198+
if (instance.allSetting.debugPath.replace("%path", "").equals("1")) {
199+
instance.debug = instance.allSetting.Path1;
200+
}
201+
if (instance.allSetting.debugPath.replace("%path", "").equals("2")) {
202+
instance.debug = instance.allSetting.Path2;
203+
}
204+
if (instance.allSetting.debugPath.replace("%path", "").equals("3")) {
205+
instance.debug = instance.allSetting.Path3;
206+
}
207+
if (instance.allSetting.debugPath.replace("%path", "").equals("4")) {
208+
instance.debug = instance.allSetting.Path4;
209+
}
210+
if (instance.allSetting.debugPath.replace("%path", "").equals("5")) {
211+
instance.debug = instance.allSetting.Path5;
212+
}
213+
if (instance.debug.equals("")) {
214+
instance.allSetting.consoleDebug = false;
217215
System.err.println("Optilog Note: Unexpected error occur when parse debugPath");
218216
}
217+
} catch (NullPointerException e) {
218+
instance.consoleFileMasterCaution = false;
219+
System.err.println("Optilog Note: Unexpected error occur when parse debugPath");
219220
}
220-
if (instance.allSetting.fatalPath.startsWith("%path") & instance.consoleFileMasterCaution) {
221-
try {
222-
if (instance.allSetting.fatalPath.replace("%path", "").equals("1")) {
223-
instance.fatal = instance.allSetting.Path1;
224-
}
225-
if (instance.allSetting.fatalPath.replace("%path", "").equals("2")) {
226-
instance.fatal = instance.allSetting.Path2;
227-
}
228-
if (instance.allSetting.fatalPath.replace("%path", "").equals("3")) {
229-
instance.fatal = instance.allSetting.Path3;
230-
}
231-
if (instance.allSetting.fatalPath.replace("%path", "").equals("4")) {
232-
instance.fatal = instance.allSetting.Path4;
233-
}
234-
if (instance.allSetting.fatalPath.replace("%path", "").equals("5")) {
235-
instance.fatal = instance.allSetting.Path5;
236-
}
237-
if (instance.fatal.equals("")) {
238-
instance.allSetting.consoleFatal = false;
239-
System.err.println("Optilog Note: Unexpected error occur when parse fatalPath");
240-
}
241-
} catch (NullPointerException e) {
242-
instance.consoleFileMasterCaution = false;
221+
}
222+
if (instance.allSetting.fatalPath.startsWith("%path") & instance.consoleFileMasterCaution) {
223+
try {
224+
if (instance.allSetting.fatalPath.replace("%path", "").equals("1")) {
225+
instance.fatal = instance.allSetting.Path1;
226+
}
227+
if (instance.allSetting.fatalPath.replace("%path", "").equals("2")) {
228+
instance.fatal = instance.allSetting.Path2;
229+
}
230+
if (instance.allSetting.fatalPath.replace("%path", "").equals("3")) {
231+
instance.fatal = instance.allSetting.Path3;
232+
}
233+
if (instance.allSetting.fatalPath.replace("%path", "").equals("4")) {
234+
instance.fatal = instance.allSetting.Path4;
235+
}
236+
if (instance.allSetting.fatalPath.replace("%path", "").equals("5")) {
237+
instance.fatal = instance.allSetting.Path5;
238+
}
239+
if (instance.fatal.equals("")) {
240+
instance.allSetting.consoleFatal = false;
243241
System.err.println("Optilog Note: Unexpected error occur when parse fatalPath");
244242
}
243+
} catch (NullPointerException e) {
244+
instance.consoleFileMasterCaution = false;
245+
System.err.println("Optilog Note: Unexpected error occur when parse fatalPath");
245246
}
246247
}
248+
247249
}
248250

249251
@OnlyInInit

src/main/java/com/optilog/setting/SettingFiles.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -321,36 +321,36 @@ public static void generateYamlSettings(String path) {
321321
}
322322
try {
323323
Files.writeString(f.toPath(), "info:\n" +
324-
" print:true\n" +
325-
" console:true\n" +
326-
" server:true\n" +
324+
" print: true\n" +
325+
" console: true\n" +
326+
" server: true\n" +
327327
"error:\n" +
328-
" print:true\n" +
329-
" console:true\n" +
330-
" server:true\n" +
328+
" print: true\n" +
329+
" console: true\n" +
330+
" server: true\n" +
331331
"warn:\n" +
332-
" print:true\n" +
333-
" console:true\n" +
334-
" server:true\n" +
332+
" print: true\n" +
333+
" console: true\n" +
334+
" server: true\n" +
335335
"debug:\n" +
336-
" print:true\n" +
337-
" console:true\n" +
338-
" server:true\n" +
336+
" print: true\n" +
337+
" console: true\n" +
338+
" server: true\n" +
339339
"fatal:\n" +
340-
" print:true\n" +
341-
" console:true\n" +
342-
" server:true\n" +
340+
" print: true\n" +
341+
" console: true\n" +
342+
" server: true\n" +
343343
"file:\n" +
344-
" defaultConsolePath:D:\\\\Program\\\\Project\\\\resources\\\\app\\\\Git\\\\Projects\\\\Optilog-Client\\\\src\\\\test\\\\resources\\\\logs\n" +
345-
" fileName:%timeLog.log\n" +
346-
" #Path1: ....\n" +
347-
" #infoPath:%path1\n" +
344+
" defaultConsolePath: \"D:\\Program\\Project\\resources\\app\\Git\\Projects\\Optilog-Client\\src\\test\\resources\\logs\"\n" +
345+
" fileName: \"%timeLog.log\"\n" +
346+
"#Path1: ....\n" +
347+
"#infoPath:%path1\n" +
348348
"server:\n" +
349-
" startClient:true\n" +
350-
" socketNumber:65535\n" +
351-
" host:localhost\n" +
349+
" startClient: true\n" +
350+
" socketNumber: 65535\n" +
351+
" host: \"localhost\"\n" +
352352
"packing:\n" +
353-
" packingFormat:[%yyyy-%MM-%dd|%HH:%mm:%ss(%SS))][%class %method(%file:%line)/%thread] %level:%msg", StandardCharsets.UTF_8);
353+
" packingFormat: \"[%yyyy-%MM-%dd|%HH:%mm:%ss(%SS))][%class %method(%file:%line)/%thread ] %level:%msg\"", StandardCharsets.UTF_8);
354354
} catch (IOException e) {
355355
e.printStackTrace();
356356
}

0 commit comments

Comments
 (0)