Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajoute l’id de session dans les logs #2063

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions app/services/EventService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import aplus.macros.Macros
import cats.syntax.all._
import java.time.{Instant, LocalDate}
import java.util.UUID
import javax.inject.Inject
import javax.inject.{Inject, Singleton}
import models.{Area, Error, Event, EventType, User}
import play.api.Logger
import play.api.db.Database
import play.api.mvc.Request
import scala.concurrent.Future
import scala.util.Try

@javax.inject.Singleton
@Singleton
class EventService @Inject() (db: Database, dependencies: ServicesDependencies) {
import dependencies.databaseExecutionContext

Expand Down Expand Up @@ -49,10 +49,12 @@ class EventService @Inject() (db: Database, dependencies: ServicesDependencies)
register(event.level)(
request.currentUser,
request.remoteAddress,
event.code,
// Note: here we should have gone through the router, so
// request.path is supposed to be valid
s"$descriptionSanitized. ${request.method} ${request.path}",
event.code, {
val session = request.userSession.map(session => " " + session.id).getOrElse("")
// Note: here we should have gone through the router, so
// request.path is supposed to be valid
s"$descriptionSanitized.$session ${request.method} ${request.path}"
},
additionalUnsafeData,
applicationId,
involvesUser,
Expand Down