This repository has been archived by the owner on Nov 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #115 from bridgecrewio/BCE-38723-New-logs-infrastr…
…ucture [BCE-38723] - Added new logs infrastructure and button + new build ti…
- Loading branch information
Showing
53 changed files
with
555 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.gradle | ||
.idea | ||
.intellijPlatform | ||
build | ||
.DS_Store | ||
bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[versions] | ||
# libraries | ||
junit = "4.13.2" | ||
jupiterApi = "5.8.1" | ||
|
||
# plugins | ||
changelog = "2.2.1" | ||
intelliJPlatform = "2.0.1" | ||
kotlin = "1.9.25" | ||
kover = "0.8.3" | ||
qodana = "0.1.13" | ||
|
||
[libraries] | ||
junit = { group = "junit", name = "junit", version.ref = "junit" } | ||
jupiterApi = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "jupiterApi" } | ||
|
||
[plugins] | ||
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" } | ||
intelliJPlatform = { id = "org.jetbrains.intellij.platform", version.ref = "intelliJPlatform" } | ||
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } | ||
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } | ||
qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.bridgecrew.log; | ||
|
||
import ch.qos.logback.classic.LoggerContext; | ||
import ch.qos.logback.core.Appender; | ||
import ch.qos.logback.core.FileAppender; | ||
import com.intellij.openapi.components.Service; | ||
import org.slf4j.LoggerFactory; | ||
|
||
@Service | ||
public final class LoggerService { | ||
|
||
public String getLogFilePath() { | ||
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); | ||
ch.qos.logback.classic.Logger rootLogger = loggerContext.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME); | ||
Appender<?> appender = rootLogger.getAppender("FILE"); | ||
if (appender instanceof FileAppender<?> fileAppender) { | ||
return fileAppender.getFile(); | ||
} | ||
return null; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/bridgecrew/util/ApplicationServiceUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.bridgecrew.util; | ||
|
||
import com.intellij.openapi.application.ApplicationManager; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class ApplicationServiceUtil { | ||
|
||
private final static Logger logger = LoggerFactory.getLogger(ApplicationServiceUtil.class); | ||
|
||
public static <T> T getService(Class<T> clazz) { | ||
T service = ApplicationManager.getApplication().getService(clazz); | ||
if (service == null) { | ||
String message = String.format("Could not find service %s", clazz.getSimpleName()); | ||
logger.error(message); | ||
throw new IllegalArgumentException(message); | ||
} | ||
return service; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.