UNPKG

@denodnt/logger

Version:

deno logger available for deno and NPM

30 lines (29 loc) 650 B
import * as dntShim from "./_dnt.shims.js"; const isTTY = dntShim.Deno.stdout.isTerminal(); import { writeAll } from "./deps.js"; /** * Deno stdout log function * @param msg */ export async function stdout(msg) { await writeAll(dntShim.Deno.stdout, msg); } /** * default log function * @param args */ export default function log(...args) { console.log(...args); } /** * No operation function */ function noop() { } /** * Only output to stdout when the terminal is a TTY */ export const stdoutOnlyTty = isTTY ? stdout : noop; /** * Only output to console when the terminal is a TTY */ export const logOnlyTty = isTTY ? log : noop;