aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/helper/LogAction.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/helper/LogAction.java')
-rw-r--r--src/main/java/org/traccar/helper/LogAction.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/helper/LogAction.java b/src/main/java/org/traccar/helper/LogAction.java
index 16d55ec60..d16b25483 100644
--- a/src/main/java/org/traccar/helper/LogAction.java
+++ b/src/main/java/org/traccar/helper/LogAction.java
@@ -17,6 +17,10 @@
package org.traccar.helper;
import java.beans.Introspector;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -46,6 +50,7 @@ public final class LogAction {
private static final String PATTERN_LOGIN = "user: %d, action: %s";
private static final String PATTERN_LOGIN_FAILED = "login failed from: %s";
private static final String PATTERN_DEVICE_ACCUMULATORS = "user: %d, action: %s, deviceId: %d";
+ private static final String PATTERN_REPORT = "user: %d, report: %s, from: %s, to: %s, devices: %s, groups: %s";
public static void create(long userId, BaseModel object) {
logObjectAction(ACTION_CREATE, userId, object.getClass(), object.getId());
@@ -92,8 +97,8 @@ public final class LogAction {
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) {
+ private static void logLinkAction(
+ String action, long userId, Class<?> owner, long ownerId, Class<?> property, long propertyId) {
LOGGER.info(String.format(
PATTERN_LINK, userId, action,
Introspector.decapitalize(owner.getSimpleName()), ownerId,
@@ -104,4 +109,13 @@ public final class LogAction {
LOGGER.info(String.format(PATTERN_LOGIN, userId, action));
}
+ public static void logReport(
+ long userId, String report, Date from, Date to, List<Long> deviceIds, List<Long> groupIds) {
+ DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+ LOGGER.info(String.format(
+ PATTERN_REPORT, userId, report,
+ dateFormat.format(from), dateFormat.format(to),
+ deviceIds.toString(), groupIds.toString()));
+ }
+
}