mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
FUS: make max file size for log files configurable
This commit is contained in:
+2
-2
@@ -19,7 +19,7 @@ interface StatisticsEventLogWriter {
|
||||
fun cleanup()
|
||||
}
|
||||
|
||||
class StatisticsEventLogFileWriter(private val recorderId: String) : StatisticsEventLogWriter {
|
||||
class StatisticsEventLogFileWriter(private val recorderId: String, private val maxFileSize: String) : StatisticsEventLogWriter {
|
||||
private var fileAppender: StatisticsEventLogFileAppender? = null
|
||||
|
||||
private val eventLogger: Logger = Logger.getLogger("event.logger.$recorderId")
|
||||
@@ -33,7 +33,7 @@ class StatisticsEventLogFileWriter(private val recorderId: String) : StatisticsE
|
||||
val dir = getEventLogDir()
|
||||
fileAppender = StatisticsEventLogFileAppender.create(pattern, dir)
|
||||
fileAppender?.let { appender ->
|
||||
appender.setMaxFileSize("200KB")
|
||||
appender.setMaxFileSize(maxFileSize)
|
||||
eventLogger.addAppender(appender)
|
||||
}
|
||||
}
|
||||
|
||||
+7
-3
@@ -8,6 +8,7 @@ import com.intellij.openapi.extensions.Extensions
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import java.io.File
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
private val LOG = Logger.getInstance("#com.intellij.internal.statistic.eventLog.StatisticsEventLogger")
|
||||
private val EP_NAME = ExtensionPointName.create<StatisticsEventLoggerProvider>("com.intellij.statistic.eventLog.eventLoggerProvider")
|
||||
@@ -19,7 +20,10 @@ interface StatisticsEventLogger {
|
||||
fun cleanup()
|
||||
}
|
||||
|
||||
abstract class StatisticsEventLoggerProvider(val recorderId: String, val version: Int, val sendFrequencyMs: Long) {
|
||||
abstract class StatisticsEventLoggerProvider(val recorderId: String,
|
||||
val version: Int,
|
||||
val sendFrequencyMs: Long = TimeUnit.HOURS.toMillis(1),
|
||||
val maxFileSize: String = "200KB") {
|
||||
open val logger: StatisticsEventLogger = createLogger()
|
||||
|
||||
abstract fun isRecordEnabled() : Boolean
|
||||
@@ -35,8 +39,8 @@ abstract class StatisticsEventLoggerProvider(val recorderId: String, val version
|
||||
}
|
||||
|
||||
val config = EventLogConfiguration
|
||||
val bucket = config.bucket.toString()
|
||||
val logger = StatisticsFileEventLogger(config.sessionId, config.build, bucket, version.toString(), StatisticsEventLogFileWriter(recorderId))
|
||||
val writer = StatisticsEventLogFileWriter(recorderId, maxFileSize)
|
||||
val logger = StatisticsFileEventLogger(config.sessionId, config.build, config.bucket.toString(), version.toString(), writer)
|
||||
Disposer.register(ApplicationManager.getApplication(), logger)
|
||||
return logger
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class FeatureUsageEventLoggerProvider : StatisticsEventLoggerProvider("FUS", 12, TimeUnit.HOURS.toMillis(1)) {
|
||||
class FeatureUsageEventLoggerProvider : StatisticsEventLoggerProvider("FUS", 12) {
|
||||
override fun isRecordEnabled(): Boolean {
|
||||
return !ApplicationManager.getApplication().isUnitTestMode &&
|
||||
Registry.`is`("feature.usage.event.log.collect.and.upload") &&
|
||||
|
||||
Reference in New Issue
Block a user