const c = {
  r: '\x1b[0m', d: '\x1b[2m',
  g: '\x1b[32m', y: '\x1b[33m', red: '\x1b[31m', cy: '\x1b[36m',
};

const ts = () => new Date().toLocaleTimeString('en-GB', { hour12: false });

export const log = {
  info: (msg: string, ...a: unknown[]) => console.log(`${c.d}${ts()}${c.r} ${c.cy}INFO${c.r}  ${msg}`, ...a),
  warn: (msg: string, ...a: unknown[]) => console.warn(`${c.d}${ts()}${c.r} ${c.y}WARN${c.r}  ${msg}`, ...a),
  error: (msg: string, ...a: unknown[]) => console.error(`${c.d}${ts()}${c.r} ${c.red}ERR${c.r}   ${msg}`, ...a),
  ok: (msg: string, ...a: unknown[]) => console.log(`${c.d}${ts()}${c.r} ${c.g}OK${c.r}    ${msg}`, ...a),
};
