console#Console TypeScript Examples

The following examples show how to use console#Console. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BufferedConsole.d.ts    From amazon-kinesis-video-streams-webrtc-sdk-js-with-amazon-cognito with MIT No Attribution 6 votes vote down vote up
export default class BufferedConsole extends Console {
    private _buffer;
    private _counters;
    private _timers;
    private _groupDepth;
    private _getSourceMaps;
    constructor(getSourceMaps: () => SourceMapRegistry | null | undefined);
    static write(buffer: ConsoleBuffer, type: LogType, message: LogMessage, level?: number | null, sourceMaps?: SourceMapRegistry | null): ConsoleBuffer;
    private _log;
    assert(value: unknown, message?: string | Error): void;
    count(label?: string): void;
    countReset(label?: string): void;
    debug(firstArg: unknown, ...rest: Array<unknown>): void;
    dir(firstArg: unknown, ...rest: Array<unknown>): void;
    dirxml(firstArg: unknown, ...rest: Array<unknown>): void;
    error(firstArg: unknown, ...rest: Array<unknown>): void;
    group(title?: string, ...rest: Array<unknown>): void;
    groupCollapsed(title?: string, ...rest: Array<unknown>): void;
    groupEnd(): void;
    info(firstArg: unknown, ...rest: Array<unknown>): void;
    log(firstArg: unknown, ...rest: Array<unknown>): void;
    time(label?: string): void;
    timeEnd(label?: string): void;
    warn(firstArg: unknown, ...rest: Array<unknown>): void;
    getBuffer(): ConsoleBuffer | undefined;
}
Example #2
Source File: CustomConsole.d.ts    From amazon-kinesis-video-streams-webrtc-sdk-js-with-amazon-cognito with MIT No Attribution 6 votes vote down vote up
export default class CustomConsole extends Console {
    private _stdout;
    private _stderr;
    private _formatBuffer;
    private _counters;
    private _timers;
    private _groupDepth;
    constructor(stdout: NodeJS.WriteStream, stderr: NodeJS.WriteStream, formatBuffer?: Formatter);
    private _log;
    private _logError;
    assert(value: unknown, message?: string | Error): asserts value;
    count(label?: string): void;
    countReset(label?: string): void;
    debug(firstArg: unknown, ...args: Array<unknown>): void;
    dir(firstArg: unknown, ...args: Array<unknown>): void;
    dirxml(firstArg: unknown, ...args: Array<unknown>): void;
    error(firstArg: unknown, ...args: Array<unknown>): void;
    group(title?: string, ...args: Array<unknown>): void;
    groupCollapsed(title?: string, ...args: Array<unknown>): void;
    groupEnd(): void;
    info(firstArg: unknown, ...args: Array<unknown>): void;
    log(firstArg: unknown, ...args: Array<unknown>): void;
    time(label?: string): void;
    timeEnd(label?: string): void;
    warn(firstArg: unknown, ...args: Array<unknown>): void;
    getBuffer(): undefined;
}
Example #3
Source File: BufferedConsole.d.ts    From amazon-kinesis-video-streams-webrtc-sdk-js-with-amazon-cognito with MIT No Attribution 6 votes vote down vote up
export default class BufferedConsole extends Console {
    private _buffer;
    private _counters;
    private _timers;
    private _groupDepth;
    private _getSourceMaps;
    constructor(getSourceMaps: () => SourceMapRegistry | null | undefined);
    static write(buffer: ConsoleBuffer, type: LogType, message: LogMessage, level?: number | null, sourceMaps?: SourceMapRegistry | null): ConsoleBuffer;
    private _log;
    assert(value: unknown, message?: string | Error): void;
    count(label?: string): void;
    countReset(label?: string): void;
    debug(firstArg: unknown, ...rest: Array<unknown>): void;
    dir(firstArg: unknown, ...rest: Array<unknown>): void;
    dirxml(firstArg: unknown, ...rest: Array<unknown>): void;
    error(firstArg: unknown, ...rest: Array<unknown>): void;
    group(title?: string, ...rest: Array<unknown>): void;
    groupCollapsed(title?: string, ...rest: Array<unknown>): void;
    groupEnd(): void;
    info(firstArg: unknown, ...rest: Array<unknown>): void;
    log(firstArg: unknown, ...rest: Array<unknown>): void;
    time(label?: string): void;
    timeEnd(label?: string): void;
    warn(firstArg: unknown, ...rest: Array<unknown>): void;
    getBuffer(): ConsoleBuffer | undefined;
}
Example #4
Source File: CustomConsole.d.ts    From amazon-kinesis-video-streams-webrtc-sdk-js-with-amazon-cognito with MIT No Attribution 6 votes vote down vote up
export default class CustomConsole extends Console {
    private _stdout;
    private _stderr;
    private _formatBuffer;
    private _counters;
    private _timers;
    private _groupDepth;
    constructor(stdout: NodeJS.WriteStream, stderr: NodeJS.WriteStream, formatBuffer?: Formatter);
    private _log;
    private _logError;
  assert(value: unknown, message?: string | Error): asserts value;
    count(label?: string): void;
    countReset(label?: string): void;
    debug(firstArg: unknown, ...args: Array<unknown>): void;
    dir(firstArg: unknown, ...args: Array<unknown>): void;
    dirxml(firstArg: unknown, ...args: Array<unknown>): void;
    error(firstArg: unknown, ...args: Array<unknown>): void;
    group(title?: string, ...args: Array<unknown>): void;
    groupCollapsed(title?: string, ...args: Array<unknown>): void;
    groupEnd(): void;
    info(firstArg: unknown, ...args: Array<unknown>): void;
    log(firstArg: unknown, ...args: Array<unknown>): void;
    time(label?: string): void;
    timeEnd(label?: string): void;
    warn(firstArg: unknown, ...args: Array<unknown>): void;
    getBuffer(): undefined;
}
Example #5
Source File: BufferedConsole.d.ts    From nlw2-proffy with MIT License 6 votes vote down vote up
export default class BufferedConsole extends Console {
    private _buffer;
    private _counters;
    private _timers;
    private _groupDepth;
    private _getSourceMaps;
    constructor(getSourceMaps: () => SourceMapRegistry | null | undefined);
    static write(buffer: ConsoleBuffer, type: LogType, message: LogMessage, level?: number | null, sourceMaps?: SourceMapRegistry | null): import("./types").LogEntry[];
    private _log;
    assert(value: any, message?: string | Error): void;
    count(label?: string): void;
    countReset(label?: string): void;
    debug(firstArg: any, ...rest: Array<any>): void;
    dir(firstArg: any, ...rest: Array<any>): void;
    dirxml(firstArg: any, ...rest: Array<any>): void;
    error(firstArg: any, ...rest: Array<any>): void;
    group(title?: string, ...rest: Array<any>): void;
    groupCollapsed(title?: string, ...rest: Array<any>): void;
    groupEnd(): void;
    info(firstArg: any, ...rest: Array<any>): void;
    log(firstArg: any, ...rest: Array<any>): void;
    time(label?: string): void;
    timeEnd(label?: string): void;
    warn(firstArg: any, ...rest: Array<any>): void;
    getBuffer(): import("./types").LogEntry[] | undefined;
}
Example #6
Source File: CustomConsole.d.ts    From nlw2-proffy with MIT License 6 votes vote down vote up
export default class CustomConsole extends Console {
    private _stdout;
    private _stderr;
    private _formatBuffer;
    private _counters;
    private _timers;
    private _groupDepth;
    constructor(stdout: NodeJS.WritableStream, stderr: NodeJS.WritableStream, formatBuffer?: Formatter);
    private _log;
    private _logError;
    assert(value: any, message?: string | Error): void;
    count(label?: string): void;
    countReset(label?: string): void;
    debug(firstArg: any, ...args: Array<any>): void;
    dir(firstArg: any, ...args: Array<any>): void;
    dirxml(firstArg: any, ...args: Array<any>): void;
    error(firstArg: any, ...args: Array<any>): void;
    group(title?: string, ...args: Array<any>): void;
    groupCollapsed(title?: string, ...args: Array<any>): void;
    groupEnd(): void;
    info(firstArg: any, ...args: Array<any>): void;
    log(firstArg: any, ...args: Array<any>): void;
    time(label?: string): void;
    timeEnd(label?: string): void;
    warn(firstArg: any, ...args: Array<any>): void;
    getBuffer(): undefined;
}
Example #7
Source File: Table.ts    From Asena with MIT License 5 votes vote down vote up
out = new Console({ stdout: ts })
Example #8
Source File: cli-tester.ts    From devmoji with Apache License 2.0 5 votes vote down vote up
setup() {
    this.stdout = this.mock(global.process.stdout)
    this.stderr = this.mock(global.process.stderr)
    this.console = global.console
    global.console = new Console({ stdout: this.stdout, stderr: this.stderr })
  }
Example #9
Source File: BufferedConsole.ts    From web with MIT License 5 votes vote down vote up
public console = new Console({ colorMode: true, stdout: this.outStream });
Example #10
Source File: log.ts    From estrella with ISC License 5 votes vote down vote up
log = new class Log implements LogAPI {
  readonly SILENT = LogLevel.Silent // = -1
  readonly ERROR  = LogLevel.Error  // = 0
  readonly WARN   = LogLevel.Warn   // = 1
  readonly INFO   = LogLevel.Info   // = 2
  readonly DEBUG  = LogLevel.Debug  // = 3

  level = LogLevel.Info

  error(...v :any[]) :void {
    if (log.level >= LogLevel.Error) {
      evalFunctionInArgs(v)
      log_console.error(stderrStyle.red(`${prog}:`), ...v)
    }
  }
  warn(...v :any[]) :void {
    if (log.level >= LogLevel.Warn) {
      evalFunctionInArgs(v)
      log_console.error(stderrStyle.magenta(`${prog}:`), ...v)
    }
  }
  info(...v :any[]) :void {
    if (log.level >= LogLevel.Info) {
      evalFunctionInArgs(v)
      log_console.log(...v)
    }
  }

  // DEPRECATED in Estrella 1.2.2
  readonly infoOnce = this.info

  readonly debug = log_debug

  get colorMode() :boolean|undefined {
    return log_colorMode
  }
  set colorMode(colorMode :boolean|undefined) {
    if (log_colorMode === colorMode) {
      return
    }
    log_colorMode = colorMode
    if (colorMode === undefined) { // auto
      log_console = console
    } else {
      log_console = new Console({
        stdout: process.stdout,
        stderr: process.stderr,
        colorMode
      })
    }
  }
}