public static function targetConfig(string $category): array
    {
        // Only log console requests and web requests that aren't getAuthTimeout requests
        $isConsoleRequest = Craft::$app->getRequest()->getIsConsoleRequest();
        if (!$isConsoleRequest && !Craft::$app->getUser()->enableSession) {
            return [];
        }

        $generalConfig = Craft::$app->getConfig()->getGeneral();

        $target = [
            'class' => FileTarget::class,
            'fileMode' => $generalConfig->defaultFileMode,
            'dirMode' => $generalConfig->defaultDirMode,
            'logVars' => [],
            'categories' => [$category, $category . ':*'],
            'logFile' => '@storage/logs/'.$category.'.log'
        ];

        if (!$isConsoleRequest) {
            // Only log errors and warnings, unless Craft is running in Dev Mode or it's being installed/updated
            if (!YII_DEBUG
                && Craft::$app->getIsInstalled()
                && !Craft::$app->getUpdates()->getIsCraftDbMigrationNeeded()
            ) {
                $target['levels'] = Logger::LEVEL_ERROR | Logger::LEVEL_WARNING;
            }
        }

        return $target;
    }