1.0.1 • Published 2 years ago

nv-error-remote v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

nv-error-remote

  • format log for remote log-db

install

  • npm install nv-error-remote

usage

const x = require("nv-error-remote")

example

    > x.log(new SyntaxError('xxx'),1001)
    {
      type: 'error',
      date: '2022-01-20 13:54:27.610',
      code: 1001,
      name: 'SyntaxError',
      message: 'xxx',
      stack: [
        'SyntaxError: xxx',
        '    at REPL2:1:7',
        '    at Script.runInThisContext (node:vm:129:12)',
        '    at REPLServer.defaultEval (node:repl:562:29)',
        '    at bound (node:domain:421:15)',
        '    at REPLServer.runBound [as eval] (node:domain:432:12)',
        '    at REPLServer.onLine (node:repl:889:10)',
        '    at REPLServer.emit (node:events:402:35)',
        '    at REPLServer.emit (node:domain:475:12)',
        '    at REPLServer.Interface._onLine (node:readline:487:10)',
        '    at REPLServer.Interface._line (node:readline:864:8)'
      ],
      signed_keys: [ 'code', 'name', 'message' ],
      sign: '60dc919c97758f6b254bb0438fc3fb371039963e',
      y: 2022,
      m: 1,
      d: 20,
      h: 13,
      min: 54,
      s: 27,
      ms: 610,
      ts: 1642658067,
      mts: 1642658067610,
      zone: '+0800',
      soffset: 28800,
      msoffset: 28800000,
      utc_wd: 'Thursday',
      lcl_wd: 'Thursday',
      extra: {}
    }



    > x.log('noerror',400)
    {
      type: 'info',
      date: '2022-01-20 14:02:42.327',
      code: 400,
      name: null,
      message: 'noerror',
      stack: [ '' ],
      signed_keys: [ 'code', 'name', 'message' ],
      sign: '4c48f2a218913feb68f35cd653e3516e8f251d2a',
      y: 2022,
      m: 1,
      d: 20,
      h: 14,
      min: 2,
      s: 42,
      ms: 327,
      ts: 1642658562,
      mts: 1642658562327,
      zone: '+0800',
      soffset: 28800,
      msoffset: 28800000,
      utc_wd: 'Thursday',
      lcl_wd: 'Thursday',
      extra: {}
    }
    >

APIS

    function log(o,code=null,extra={},zone='+0800',signed_keys=['code','name','message']) {

    function _creat_timed(zone='+0800') {

    function error(err,code=null,extra={},zone='+0800',signed_keys=['code','name','message']) {
    function info(msg,code=null,extra={},zone='+0800',signed_keys=['code','name','message']) {
    function warning(msg,code=null,extra={},zone='+0800',signed_keys=['code','name','message']) {

    function from_json(J) {

LICENSE

  • ISC