import {logger} from 'hono/logger'

const redactTokens = (s: string) =>
  s.replace(/token=[^&\s]+/g, 'token=[redacted]')

export const requestLogger = () =>
  logger((str, ...rest) => console.log(redactTokens(str), ...rest))
