Skip to content

Commit 3cf8b1d

Browse files
committed
improve trace log in EventBus
1 parent 7111b56 commit 3cf8b1d

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

src/main/java/act/app/event/AppEvent.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,20 @@
2525
import act.event.SystemEvent;
2626

2727
public abstract class AppEvent extends ActEvent<App> implements SystemEvent {
28-
private int id;
28+
29+
private AppEventId id;
30+
2931
public AppEvent(AppEventId id, App source) {
3032
super(source);
31-
this.id = id.ordinal();
33+
this.id = id;
3234
}
35+
36+
@Override
37+
public String toString() {
38+
return id.name();
39+
}
40+
3341
public int id() {
34-
return id;
42+
return id.ordinal();
3543
}
3644
}

src/main/java/act/event/EventBus.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ public synchronized EventBus trigger(AppEventId eventId) {
292292

293293
public synchronized EventBus emit(final AppEvent event) {
294294
if (isTraceEnabled()) {
295-
trace("emitting app event: %s", event.id());
295+
trace("emitting app event: %s", event);
296296
}
297297
if (isDestroyed()) {
298298
return this;
@@ -312,7 +312,7 @@ public synchronized EventBus emitAsync(AppEventId eventId) {
312312

313313
public synchronized EventBus emitAsync(final AppEvent event) {
314314
if (isTraceEnabled()) {
315-
trace("emitting app event asynchronously: %s", event.id());
315+
trace("emitting app event asynchronously: %s", event);
316316
}
317317
if (isDestroyed()) {
318318
return this;

0 commit comments

Comments
 (0)