MCPcopy Create free account
hub / github.com/e2wugui/zeze / DefaultLogAction

Method DefaultLogAction

ZezeJava/ZezeJava/src/main/java/Zeze/Util/Task.java:478–517  ·  view source on GitHub ↗
(@Nullable Throwable ex, long result, @Nullable Protocol<?> p,
										@NotNull String actionName)

Source from the content-addressed store, hash-verified

476 }
477
478 public static void DefaultLogAction(@Nullable Throwable ex, long result, @Nullable Protocol<?> p,
479 @NotNull String actionName) {
480 // exception -> Error
481 // 0 != result -> level from p or Info
482 // others -> Trace
483 Level level;
484 if (ex != null)
485 level = Level.ERROR;
486 else if (result != 0) {
487 Service s;
488 Application zeze;
489 if (p != null && (s = p.getService()) != null && (zeze = s.getZeze()) != null)
490 level = zeze.getConfig().getProcessReturnErrorLogLevel();
491 else
492 level = Level.INFO;
493 } else {
494 if (!logger.isTraceEnabled())
495 return;
496 level = Level.TRACE;
497 }
498 Object userState;
499 String userStateStr = p != null && (userState = p.getUserState()) != null ? " UserState=" + userState : "";
500
501 var moduleId = 0;
502 var errCode = result;
503 if (result > 0) {
504 moduleId = IModule.getModuleId(result);
505 errCode = IModule.getErrorCode(result);
506 }
507
508 if (null == ex) {
509 logger.log(level, "Action={}{} Return={}:{} Arg={}",
510 actionName, userStateStr, moduleId, errCode,
511 p != null ? AsyncSocket.toStr(p.Argument) : "");
512 } else {
513 logger.log(level, "Action={}{} Return={}:{} Arg={}",
514 actionName, userStateStr, moduleId, errCode,
515 p != null ? AsyncSocket.toStr(p.Argument) : "", ex);
516 }
517 }
518
519 public static void logAndStatistics(long result, @Nullable Protocol<?> p, boolean isRequestSaved) {
520 logAndStatistics(null, result, p, isRequestSaved, null);

Callers

nothing calls this directly

Calls 9

getZezeMethod · 0.95
getConfigMethod · 0.95
getModuleIdMethod · 0.95
getErrorCodeMethod · 0.95
toStrMethod · 0.95
getServiceMethod · 0.45
getUserStateMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected