|
15 | 15 | import com.vaadin.flow.data.provider.Query;
|
16 | 16 | import com.vaadin.flow.router.PageTitle;
|
17 | 17 | import com.vaadin.flow.router.Route;
|
| 18 | +import org.slf4j.Logger; |
18 | 19 | import org.slf4j.LoggerFactory;
|
19 | 20 | import org.togetherjava.tjbot.logwatcher.accesscontrol.AllowedRoles;
|
20 | 21 | import org.togetherjava.tjbot.logwatcher.accesscontrol.Role;
|
@@ -42,6 +43,7 @@ public class UserManagement extends VerticalLayout {
|
42 | 43 |
|
43 | 44 | private final transient UserRepository repo;
|
44 | 45 | private final Grid<UserWrapper> grid = new Grid<>(UserWrapper.class, false);
|
| 46 | + private static final Logger logger = LoggerFactory.getLogger(UserManagement.class); |
45 | 47 |
|
46 | 48 | public UserManagement(UserRepository repository) {
|
47 | 49 | this.repo = repository;
|
@@ -81,8 +83,7 @@ private Stream<UserWrapper> onAll(Query<UserWrapper, Void> query) {
|
81 | 83 | .map(user -> new UserWrapper(user.getDiscordid(), user.getUsername(),
|
82 | 84 | this.repo.fetchRolesForUser(user)));
|
83 | 85 | } catch (final DatabaseException e) {
|
84 |
| - LoggerFactory.getLogger(UserManagement.class) |
85 |
| - .error("Exception occurred while fetching.", e); |
| 86 | + logger.error("Exception occurred while fetching.", e); |
86 | 87 | NotificationUtils.getNotificationForError(e).open();
|
87 | 88 | return Stream.empty();
|
88 | 89 | }
|
@@ -133,8 +134,7 @@ private void doUpdate(UserWrapper user) {
|
133 | 134 |
|
134 | 135 | UserManagement.this.repo.saveRolesForUser(toSave, user.getRoles());
|
135 | 136 | } catch (DatabaseException e) {
|
136 |
| - LoggerFactory.getLogger(UserManagement.class) |
137 |
| - .error("Exception occurred while saving.", e); |
| 137 | + logger.error("Exception occurred while saving.", e); |
138 | 138 | NotificationUtils.getNotificationForError(e).open();
|
139 | 139 | }
|
140 | 140 |
|
@@ -193,8 +193,7 @@ private void doRemove(UserWrapper user) {
|
193 | 193 | try {
|
194 | 194 | UserManagement.this.repo.delete(new Users(user.getDiscordID(), user.getUserName()));
|
195 | 195 | } catch (DatabaseException e) {
|
196 |
| - LoggerFactory.getLogger(UserManagement.class) |
197 |
| - .error("Exception occurred while removing.", e); |
| 196 | + logger.error("Exception occurred while removing.", e); |
198 | 197 | NotificationUtils.getNotificationForError(e).open();
|
199 | 198 | }
|
200 | 199 | }
|
|
0 commit comments