OverviewFilesCommitsIssuesDocsReleasesPeers

holepunchto-kb / skills / hypercore-logger / api-extract.json

47 lines · json ref:
{
  "repo": "hypercore-logger",
  "timestamp": "2026-01-16T23:56:41.124Z",
  "entryPoint": "index.js",
  "exports": {
    "packageJson": {
      "main": "index.js"
    }
  },
  "api": {
    "file": "index.js",
    "exports": [
      {
        "type": "default",
        "name": "class"
      }
    ],
    "classes": [
      {
        "name": "HypercoreLogger"
      }
    ],
    "functions": []
  },
  "readme": {
    "content": "# hypercore-logger\n\nDistributed logger\n\n```\nnpm install hypercore-logger\n```\n\n## Usage\n\n``` js\nconst Logger = require('hypercore-logger')\n\n// pass backing hypercore\nconst log = new Logger(core)\n\n// add a log message\nawait log.log({ hello: 'world' })\n```\n\nSetup swarming with Hyperswarm on the core and somewhere else\n\n```js\nconst log = new Logger(core)\n\nfor await (const { timestamp, stats, message } of log.tail()) {\n  console.log(timestamp, stats, message)\n}\n```\n\n## API\n\n### `Logger`\n\n#### `const log = new Logger(core)`\n\nCreate a new logger backed by a [Hypercore](https://github.com/holepunchto/hypercore) (`core`).\n\n#### `log.discoveryKey`\n\nThe [`discoverKey`](https://github.com/holepunchto/hypercore#corediscoverykey) of the Hypercore backing the log.\n\n#### `log.key`\n\nThe [`key`](https://github.com/holepunchto/hypercore#corekey) of the Hypercore backing the log.\n\n#### `await log.ready()`\n\nWait for the log to fully open.\n\n#### `await log.log(...msg)`\n\nLog the `msg` arguments as a string r",
    "sections": [
      "intro",
      "usage",
      "api",
      "cli",
      "license"
    ],
    "hasApi": true,
    "hasExamples": true,
    "exampleCount": 7,
    "examples": [
      "npm install hypercore-logger",
      "Setup swarming with Hyperswarm on the core and somewhere else",
      "## API\n\n### `Logger`\n\n#### `const log = new Logger(core)`\n\nCreate a new logger backed by a [Hypercore](https://github.com/holepunchto/hypercore) (`core`).\n\n#### `log.discoveryKey`\n\nThe [`discoverKey`](https://github.com/holepunchto/hypercore#corediscoverykey) of the Hypercore backing the log.\n\n#### `log.key`\n\nThe [`key`](https://github.com/holepunchto/hypercore#corekey) of the Hypercore backing the log.\n\n#### `await log.ready()`\n\nWait for the log to fully open.\n\n#### `await log.log(...msg)`\n\nLog the `msg` arguments as a string representation intended for debugging, like `console.log()`'s output.\n\nIn addition to the string representation, metadata is automatically added to each log. Each appended to the backing Hypercore will look like:"
    ]
  },
  "patterns": [
    "append-only-log",
    "peer-discovery"
  ]
}