<commit_before>
// side effects for log functionality

import { clone } from './core'
import { stateOf } from './core/inputs'

export const warn = (source: string, description: string) =>
  console.warn(`source: ${source}, description: ${description}`)

export const error = (source: string, description: string) =>
  console.error(`source: ${source}, description: ${description}`)

export const beforeInput = (ctx, inputName, data) => {
  let state = stateOf(ctx)()
  if (typeof state === 'object') {
    state = clone(state)
  }
  // <any> until groupCollapsed issue in TS repo is merged https://github.com/Microsoft/TypeScript/pull/15630
  ;(<any> console.groupCollapsed)(
    `%c input %c${inputName} %cfrom %c${ctx.id}`,
    'color: #626060; font-size: 12px;',
    'color: #3b3a3a; font-size: 14px;',
    'color: #626060; font-size: 12px;',
    'color: #3b3a3a; font-size: 14px;'
  )
  console.info('%c input data  ', 'color: rgb(9, 157, 225); font-weight: bold;', data)
  console.info('%c prev state  ', 'color: #AFAFAF; font-weight: bold;', state)<commit_msg>Fix log input import<commit_after>
// side effects for log functionality

import { clone } from './core'
import { stateOf } from './core/input'

export const warn = (source: string, description: string) =>
  console.warn(`source: ${source}, description: ${description}`)

export const error = (source: string, description: string) =>
  console.error(`source: ${source}, description: ${description}`)

export const beforeInput = (ctx, inputName, data) => {
  let state = stateOf(ctx)()
  if (typeof state === 'object') {
    state = clone(state)
  }
  // <any> until groupCollapsed issue in TS repo is merged https://github.com/Microsoft/TypeScript/pull/15630
  ;(<any> console.groupCollapsed)(
    `%c input %c${inputName} %cfrom %c${ctx.id}`,
    'color: #626060; font-size: 12px;',
    'color: #3b3a3a; font-size: 14px;',
    'color: #626060; font-size: 12px;',
    'color: #3b3a3a; font-size: 14px;'
  )
  console.info('%c input data  ', 'color: rgb(9, 157, 225); font-weight: bold;', data)
  console.info('%c prev state  ', 'color: #AFAFAF; font-weight: bold;', state)
{'fraction_non_alphanumeric': 0.17867165575304023, 'fraction_numerical': 0.03554724041159962, 'mean_word_length': 4.294554455445544, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 2, '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': '3564117', 'n_tokens_mistral': 780, 'n_tokens_neox': 726, 'n_words': 206}