1.3.0 • Published 3 years ago

logpastry-client v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Logpastry Client

해당 프로젝트는 코드레시피 node runtime을 위한 로그 스크립트 래퍼입니다.
node 프로젝트에서 쉽게 import 및 사용 할 수 있도록 돕습니다.

How to use

Installation

npm install --save github:coderecipe-devteam/logpastry-client

Use in javascript & typescript

import Pastry from 'logpastry-client'

const pastry = Pastry({
  storageInfo: { // 로그를 적재할 ES정보
    protocol: 'http',
    address: 'pastry.logipasta.com',
    port: 9200,
  },
  defaultValue: { // pid, time, env 등의 데이터는 자동 바인딩 됩니다.
    project: 'pastry-client',
  }
})

const PastryLog = pastry({
  logger: 'log',
  index: 'pastry-log',
  type: 'flattened',
  defaultValue: {
    // 로그에 포함할 기본값
  }
})
const PastryError = pastry({
  logger: 'error',
  index: 'pastry-error',
  type: 'flattened',
  defaultValue: {
    // 로그에 포함할 기본값
  }
})

PastryLog(1, 2, 3)
PastryLog({ msg: 'Hello world!' })

PastryError(new Error('insung'))

/* log example
{
  pid: 4879,
  time: 2021-06-08T05:41:08.292Z,
  env: 'dev',
  project: 'pastry-client',
  data: [ 1, 2, 3 ]
}
{
  pid: 4879,
  time: 2021-06-08T05:41:08.298Z,
  env: 'dev',
  project: 'pastry-client',
  data: [ { msg: 'Hello world!' } ]
}

{
  pid: 5065,
  time: 2021-06-08T05:48:47.501Z,
  env: 'dev',
  project: 'pastry-client',
  data: [
    'Error: insung\n' +
      ... //trace
  ]
}
*/
1.3.0

3 years ago

1.2.2

3 years ago