package flutter.guru.guru_applovin_flutter.log

import java.text.SimpleDateFormat
import java.util.Locale
import java.util.logging.Formatter
import java.util.logging.LogRecord

class MainFormatter : Formatter() {

    private val dateTimeFormatter = SimpleDateFormat("yyyyMMdd'T'HHmmss", Locale.getDefault())

    override fun format(record: LogRecord?): String {
        if (record == null) return ""
        val formatTime = dateTimeFormatter.format(record.millis)
        val message = formatMessage(record)
        return "$formatTime $message\n"
    }
}