<commit_before>(ns tyranitar.setup
    (:require [tyranitar.web :as web]
              [environ.core :refer [env]]
              [clojure.string :as cs :only (split)]
              [clojure.tools.logging :refer (info warn error)]
              [clojure.java.io :as io]
              [ring.adapter.jetty :refer [run-jetty]])
    (:import (java.lang Integer Throwable)
             (java.util.logging LogManager)
             (com.yammer.metrics Metrics)
             (com.yammer.metrics.core MetricName)
             (com.ovi.common.metrics.graphite GraphiteReporterFactory GraphiteName ReporterState)
             (com.ovi.common.metrics HostnameFactory)
             (org.slf4j.bridge SLF4JBridgeHandler)
             (java.util.concurrent TimeUnit))
    (:gen-class))

(defn read-file-to-properties [file-name]
  (with-open [^java.io.Reader reader (io/reader file-name)]
    (let [props (java.util.Properties.)]
      (.load props reader)
      (into {} (for [[k v] props] [k v])))))

(defn configure-logging []
  (.reset (LogManager/getLogManager))
  ;Route all java.util.logging log statements to slf4j<commit_msg>Use Nokia instrumented Jetty<commit_after>(ns tyranitar.setup
    (:require [tyranitar.web :as web]
              [environ.core :refer [env]]
              [clojure.string :as cs :only (split)]
              [clojure.tools.logging :refer (info warn error)]
              [clojure.java.io :as io]
              [nokia.adapter.instrumented-jetty :refer [run-jetty]])
    (:import (java.lang Integer Throwable)
             (java.util.logging LogManager)
             (com.yammer.metrics Metrics)
             (com.yammer.metrics.core MetricName)
             (com.ovi.common.metrics.graphite GraphiteReporterFactory GraphiteName ReporterState)
             (com.ovi.common.metrics HostnameFactory)
             (org.slf4j.bridge SLF4JBridgeHandler)
             (java.util.concurrent TimeUnit))
    (:gen-class))

(defn read-file-to-properties [file-name]
  (with-open [^java.io.Reader reader (io/reader file-name)]
    (let [props (java.util.Properties.)]
      (.load props reader)
      (into {} (for [[k v] props] [k v])))))

(defn configure-logging []
  (.reset (LogManager/getLogManager))
  ;Route all java.util.logging log statements to slf4j
{'fraction_non_alphanumeric': 0.12847682119205298, 'fraction_numerical': 0.0026490066225165563, 'mean_word_length': 2.4595419847328244, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4704292', 'n_tokens_mistral': 720, 'n_tokens_neox': 708, 'n_words': 158}