How to use the batch-cluster.Logger.withLevels function in batch-cluster

To help you get started, we’ve selected a few batch-cluster examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github photostructure / exiftool-vendored.js / src / _chai.spec.ts View on Github external
import { Deferred, Logger, setLogger } from "batch-cluster"
import { createHash } from "crypto"
import * as fse from "fs-extra"
import { tmpdir } from "os"
import { join } from "path"
import { env } from "process"

import { orElse } from "./Maybe"

const chai = require("chai")
chai.use(require("chai-as-promised"))
chai.use(require("chai-subset"))

// Tests should be quiet unless LOG is set
setLogger(
  Logger.withLevels(
    Logger.withTimestamps(
      Logger.filterLevels(
        {
          trace: console.log,
          debug: console.log,
          info: console.log,
          warn: console.warn,
          error: console.error
        },
        orElse(env.LOG as any, "error")
      )
    )
  )
)

export { expect } from "chai"
github photostructure / exiftool-vendored.js / src / update / mktags.ts View on Github external
const exiftool = new ExifTool({
  maxProcs: 8,
  taskRetries: 3,
  streamFlushMillis: 1,
  minDelayBetweenSpawnMillis: 0
})

function ellipsize(str: string, max: number) {
  str = "" + str
  return str.length < max ? str : str.substring(0, max - 1) + "…"
}

// NO SRSLY STOP SCROLLING IT REALLY IS BAD

setLogger(
  Logger.withLevels(
    Logger.withTimestamps(
      Logger.filterLevels(
        {
          trace: console.log,
          debug: console.log,
          info: console.log,
          warn: console.warn,
          error: console.error
        },
        orElse(env.LOG as any, "info")
      )
    )
  )
)

on("uncaughtException", (error: any) => {
github photostructure / exiftool-vendored.js / src / _chai.spec.ts View on Github external
import { Deferred, Logger, setLogger } from "batch-cluster"
import { createHash } from "crypto"
import * as fse from "fs-extra"
import { tmpdir } from "os"
import { join } from "path"
import { env } from "process"

import { orElse } from "./Maybe"

const chai = require("chai")
chai.use(require("chai-as-promised"))
chai.use(require("chai-arrays"))

// Tests should be quiet unless LOG is set
setLogger(
  Logger.withLevels(
    Logger.withTimestamps(
      Logger.filterLevels(
        {
          trace: console.log,
          debug: console.log,
          info: console.log,
          warn: console.warn,
          error: console.error
        },
        orElse(env.LOG as any, "error")
      )
    )
  )
)

export { expect } from "chai"