diff options
author | Abyss777 <abyss@fox5.ru> | 2017-12-19 12:40:00 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-12-19 12:40:00 +0500 |
commit | 7858975ecb7d78106ad6dec829b838073d0db098 (patch) | |
tree | af99c8f46c9f27b506d2eac56701fe5161691451 | |
parent | 6028f7b37c4fc8bf1e771b33aee09e5f4276c5cf (diff) | |
download | traccar-server-7858975ecb7d78106ad6dec829b838073d0db098.tar.gz traccar-server-7858975ecb7d78106ad6dec829b838073d0db098.tar.bz2 traccar-server-7858975ecb7d78106ad6dec829b838073d0db098.zip |
Decapitalize words in log patterns
-rw-r--r-- | src/org/traccar/helper/LogAction.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/org/traccar/helper/LogAction.java b/src/org/traccar/helper/LogAction.java index 081702408..d2c7ef5c1 100644 --- a/src/org/traccar/helper/LogAction.java +++ b/src/org/traccar/helper/LogAction.java @@ -16,6 +16,8 @@ */ package org.traccar.helper; +import java.beans.Introspector; + import org.traccar.model.BaseModel; public final class LogAction { @@ -35,10 +37,10 @@ public final class LogAction { private static final String ACTION_TOTAL_DISTANCE = "resetTotalDistance"; - private static final String PATTERN_OBJECT = "User: %d, Action: %s, Object: %s, Id: %d"; - private static final String PATTERN_LINK = "User: %d, Action: %s, Owner: %s, Id: %d, Property: %s, Id: %d"; - private static final String PATTERN_LOGIN = "User: %d, Action: %s"; - private static final String PATTERN_TOTAL_DISTANCE = "User: %d, Action: %s, DeviceId: %d"; + private static final String PATTERN_OBJECT = "user: %d, action: %s, object: %s, id: %d"; + private static final String PATTERN_LINK = "user: %d, action: %s, owner: %s, id: %d, property: %s, id: %d"; + private static final String PATTERN_LOGIN = "user: %d, action: %s"; + private static final String PATTERN_TOTAL_DISTANCE = "user: %d, action: %s, deviceId: %d"; public static void create(long userId, BaseModel object) { logObjectAction(ACTION_CREATE, userId, object.getClass(), object.getId()); @@ -73,13 +75,14 @@ public final class LogAction { } private static void logObjectAction(String action, long userId, Class<?> clazz, long objectId) { - log(String.format(PATTERN_OBJECT, userId, action, clazz.getSimpleName(), objectId)); + log(String.format(PATTERN_OBJECT, userId, action, Introspector.decapitalize(clazz.getSimpleName()), objectId)); } private static void logLinkAction(String action, long userId, Class<?> owner, long ownerId, Class<?> property, long propertyId) { log(String.format(PATTERN_LINK, userId, action, - owner.getSimpleName(), ownerId, property.getSimpleName(), propertyId)); + Introspector.decapitalize(owner.getSimpleName()), ownerId, + Introspector.decapitalize(property.getSimpleName()), propertyId)); } private static void logLoginAction(String action, long userId) { |