<commit_before>(ns ^{:added "2.0.0" :author "<NAME>"}
  obb-rules.logger
  "Specific logger that can be turned on and off"
  (:require [obb-rules.simplifier :as simplify]))

(def ^:dynamic *verbose* false)

(defmacro log
  "Logs the given data"
  [& args]
  `(when *verbose*
    (println ~@args)))

(defn ai-turn
  "Logs ai-turn header"
  [ai-name game]
  (log "## ~~~~~~~~~~~~~~~~~~~~~~")
  (log "## AI Turn:" ai-name)
  (log "Game:")
  (log (simplify/clean-result {:board game})))

(defmacro with-verbose
  "Runs the given code in verbose mode"
  [& body]
  `(binding [*verbose* true]
    ~@body))

(defn ai-option
  "Logs an AI option"
  [option]
  (log (:actions option))
  (log "\tValue:" (:value option)
       "(" (:old-value option) ")"<commit_msg>Use log fn instead of macro on cljs<commit_after>(ns ^{:added "2.0.0" :author "<NAME>"}
  obb-rules.logger
  "Specific logger that can be turned on and off"
  (:require [obb-rules.simplifier :as simplify]))

(def ^:dynamic *verbose* false)

#?(:clj
  (defmacro log
    "Logs the given data"
    [& args]
    `(when *verbose*
      (println ~@args))))

#?(:cljs
  (defn log
    "Logs the given data"
    [& args]
    (when *verbose*
      (apply println args))))

(defn ai-turn
  "Logs ai-turn header"
  [ai-name game]
  (log "## ~~~~~~~~~~~~~~~~~~~~~~")
  (log "## AI Turn:" ai-name)
  (log "Game:")
  (log (simplify/clean-result {:board game})))

(defmacro with-verbose
  "Runs the given code in verbose mode"
  [& body]
  `(binding [*verbose* true]
    ~@body))

(defn ai-option
  "Logs an AI option"
  [option]
  (log (:actions option))
  (log "\tValue:" (:value option)
       "(" (:old-value option) ")"
{'fraction_non_alphanumeric': 0.20252403846153846, 'fraction_numerical': 0.003605769230769231, 'mean_word_length': 3.4047619047619047, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1430025', 'n_tokens_mistral': 647, 'n_tokens_neox': 614, 'n_words': 185}