Skip to content

Commit

Permalink
Merge pull request #1373 from VOSID8/main
Browse files Browse the repository at this point in the history
Adding a few loggers to provide better insights and debugging
  • Loading branch information
adpi2 authored Apr 3, 2024
2 parents ab52e49 + 6f0b5e1 commit fb5a47b
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ scaladex.log
.metals/
**/project/metals.sbt
.bsp/
.vscode/
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ class ProjectPages(env: Env, database: WebDatabase, searchEngine: SearchEngine)(
)
Future.successful(redirect(redirectUri, StatusCodes.MovedPermanently))
case Some(project) => f(project)
case None => Future.successful(complete(StatusCodes.NotFound, notfound(env, user)))
case None =>
logger.warn(s"Project $ref not found")
Future.successful(complete(StatusCodes.NotFound, notfound(env, user)))
}
onSuccess(future)(identity)
}
Expand Down Expand Up @@ -248,6 +250,7 @@ class ProjectPages(env: Env, database: WebDatabase, searchEngine: SearchEngine)(

private def getProjectPage(ref: Project.Reference, user: Option[UserState]): Route =
getProjectOrRedirect(ref, user) { project =>
logger.info(s"Accessing project page for: $ref")
for {
header <- getProjectHeader(project)
directDependencies <-
Expand All @@ -256,6 +259,7 @@ class ProjectPages(env: Env, database: WebDatabase, searchEngine: SearchEngine)(
.getOrElse(Future.successful(Seq.empty))
reverseDependencies <- database.getProjectDependents(ref)
} yield {
logger.info(s"Successfully retrieved project data for: $ref")
val groupedDirectDependencies = directDependencies
.groupBy(_.target)
.view
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ object ActiveNavObserver {
// ignore the observed entry and update all sections instead
debounceUpdate = timers.setTimeout(150) {
for ((section, navItem) <- sectionsAndNavItem)
if (isInViewport(section)) navItem.classList.add("active")
else navItem.classList.remove("active")
if (isInViewport(section)) {
navItem.classList.add("active")
println(s"Section ${section.getAttribute("id")} is in viewport")
} else {
navItem.classList.remove("active")
println(s"Section ${section.getAttribute("id")} is out of viewport")
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion project/Docker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ object Docker {
def kill(containerId: String): Unit =
try client.killContainerCmd(containerId).exec()
catch {
case _: Throwable => ()
case e: Throwable =>
// Log the error
println(s"Error killing container $containerId: ${e.getMessage}")
}
}
1 change: 1 addition & 0 deletions project/Elasticsearch.scala
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ object Elasticsearch extends AutoPlugin {
container.getFirstMappedPort()
} catch {
case e: Throwable =>
logger.error(s"Error starting Elasticsearch container: {$e}")
container.stop()
throw e
}
Expand Down
1 change: 1 addition & 0 deletions project/Postgres.scala
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ object Postgres extends AutoPlugin {
container.getFirstMappedPort()
} catch {
case e: Throwable =>
logger.error(s"Error starting PostgreSQL container: {$e}")
container.close()
throw e
}
Expand Down

0 comments on commit fb5a47b

Please sign in to comment.