當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript @util.logger類代碼示例

本文整理匯總了TypeScript中@util.logger的典型用法代碼示例。如果您正苦於以下問題:TypeScript logger類的具體用法?TypeScript logger怎麽用?TypeScript logger使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了logger類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: require

export const strategyLoader = (strategyName: string) => {
  try {
    if (strategyName === null || strategyName === undefined || !strategyName.length) throw new Error('No strategy given.')
    logger.verbose(`Loading ${strategyName}....`)
    const strategyModule = require(`./${strategyName}`)
    if (!strategyModule.strategy) throw Error("Wrong exported strategy. Export Strategy as field 'strategy'.")
    logger.silly(`Loaded ${strategyName} successfully.`)
    return strategyModule.strategy
  } catch (e) {
    throw new Error(`Strategy-Module ${strategyName} has thrown an error when loaded! Error-Message: ${e}`)
  }
}
開發者ID:magic8bot,項目名稱:magic8bot,代碼行數:12,代碼來源:index.ts

示例2: fetchTicker

  public async fetchTicker(symbol: string) {
    const fn = () => this.exchangeConnection.fetchTicker(symbol)
    const res = await this.bottleneck.schedule(fn)

    const debug = { name: 'fetchTicker', req: { symbol }, res }
    logger.debug(JSON.stringify(debug))

    return res
  }
開發者ID:magic8bot,項目名稱:magic8bot,代碼行數:9,代碼來源:exchange.wrapper.ts

示例3: cancelOrder

  public async cancelOrder(orderId: string) {
    const fn = () => this.exchangeConnection.cancelOrder(orderId)
    const res = await this.bottleneck.schedule(fn)

    const debug = { name: 'cancelOrder', req: { orderId }, res }
    logger.debug(JSON.stringify(debug))

    return res
  }
開發者ID:magic8bot,項目名稱:magic8bot,代碼行數:9,代碼來源:exchange.wrapper.ts

示例4: checkOrder

  public async checkOrder(orderId: string): Promise<OrderWithTrades> {
    const fn = () => this.exchangeConnection.fetchOrder(orderId)
    const res: any = await this.bottleneck.schedule(fn)

    const debug = { name: 'checkOrder', req: { orderId }, res }
    logger.debug(JSON.stringify(debug))

    return res
  }
開發者ID:magic8bot,項目名稱:magic8bot,代碼行數:9,代碼來源:exchange.wrapper.ts

示例5: createOrder

  public async createOrder(symbol: string, type: string, side: string, amount: number, price: number): Promise<Order> {
    const fn = () => this.exchangeConnection.createOrder(symbol, type, side, amount, price)
    const res = await this.bottleneck.schedule(fn)

    const debug = { name: 'createOrder', req: { symbol, type, side, amount, price }, res }
    logger.debug(JSON.stringify(debug))

    return res
  }
開發者ID:magic8bot,項目名稱:magic8bot,代碼行數:9,代碼來源:exchange.wrapper.ts

示例6: fetchBalance

  public async fetchBalance() {
    const fn = () => this.exchangeConnection.fetchBalance()
    const res = await this.bottleneck.schedule(fn)

    const debug = { name: 'fetchBalance', req: {}, res }
    logger.debug(JSON.stringify(debug))

    return res
  }
開發者ID:magic8bot,項目名稱:magic8bot,代碼行數:9,代碼來源:exchange.wrapper.ts

示例7: async

const run = async () => {
  try {
    logger.info('Starting magic8bot...')

    await dbDriver.connect('mongo')

    wsServer.init()
    await server.init()
    await core.init()
  } catch (e) {
    console.error(e)
  }
}
開發者ID:magic8bot,項目名稱:magic8bot,代碼行數:13,代碼來源:index.ts

示例8: error

 public error(error: string) {
   logger.error(error)
   return { error: `Core Error: ${error}` }
 }
開發者ID:magic8bot,項目名稱:magic8bot,代碼行數:4,代碼來源:core.helpers.ts


注:本文中的@util.logger類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。