@guildxyz/logging
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Guild Logging

Logging util for Guild.xyz's backend infrastructure.

Installation

npm install @guildxyz/logging

Example usage

import GuildLogger from "@guildxyz/logging";

const guildLogger = new GuildLogger({
  correlator: myCorrelator, // correlation id provider
  json: true, // format logs as json
  level: "debug", // log level
  silent: false, // hide all logs
  pretty: true, // prettify json logs / colorize text logs
});

guildLogger.info("user joined guild", {
  params: { connect: false },
  user: { address: "0x123" },
  guild: { id: 1985 },
  role: [{ id: 1904 }, { id: 1905 }],
  error: platformError, // the key has to be 'error' to log it properly
});

output

{
  params: { connect: false },
  user: { address: '0x123' },
  guild: { id: 1985 },
  role: [ { id: 1904 }, { id: 1905 } ],
  myMetadata: { myKey: 'myValue' },
  correlationId: '4fb94571-7f97-4fe0-a1b8-eb82994fb754',
  function: 'Object.<anonymous>',
  file: '/home/user/guild-logging/example.ts:12:13',
  level: 'info',
  message: 'user joined guild',
  timestamp: '2023-04-20 14:47:05',
  error: {name: 'PlatformError', message: 'add role failed', stack: ...}
}

Readme

Keywords

none

Package Sidebar

Install

npm i @guildxyz/logging

Weekly Downloads

3

Version

1.0.3

License

MIT

Unpacked Size

16 kB

Total Files

18

Last publish

Collaborators

  • baloo-xyz
  • jmezo
  • devidxyz
  • ejayxyz
  • brunya_eth