Skip to content

feat: support loglayer logger #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

theogravity
Copy link

@theogravity theogravity commented Jun 6, 2025

This adds support for the LogLayer logger (of which I am the author).

I have tested the functionality with the following code:

import * as HyperDX from "@hyperdx/node-opentelemetry";
import {LogLayer} from "loglayer";
import express from 'express';

HyperDX.init({
  apiKey: "...",
  service: "testing-service",
});

const logger = new LogLayer({
  transport: [
    HyperDX.getLogLayerTransport("info", {
      detectResources: true,
    }),
  ]
})

// Express server setup
const app = express();
const port = 3000;

app.get('/', (req, res) => {
  logger.withMetadata({
    foo: "bar",
  }).info("Hello World!")

  res.send('OK');
});

app.listen(port, () => {
  logger.info(`Server is running on port ${port}`);
});

Results in:

image

image

Copy link

changeset-bot bot commented Jun 6, 2025

⚠️ No Changeset found

Latest commit: 05a16d6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@theogravity
Copy link
Author

theogravity commented Jun 6, 2025

  • What's missing is docs for this. Where should I be updating it / when?
  • Should I be adding a changeset myself from the repo root? If so, would it be a minor level bump for this package?

maxLevel?: LogLevelType;
};

export default class HyperDXLogLayer
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For more info on how this transport is implemented:

https://loglayer.dev/transports/creating-transports.html

@theogravity
Copy link
Author

PR is good to review at this point. I do not have any further changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant