Closed msafi closed 2 years ago
Hello @msafi,
Are you looking for https://vercel.com/integrations/datadog-logs? or on which part of your Vercel app would you like to use browser-sdk?
Thanks for the response @bcaudan!
I'm looking to collect log events manually, things like user clicks, certain functions (and their parameters) on the server side, etc. Some parts of a Next.js/Vercel app are universal, they run on both the server and the client. I'd like to use this library for both. For example, I want to log things within the getStaticProps
function of my Next.js app using this library.
ok, so this library is designed for the client side only. Since we are using various browser APIs, it should probably not work out of the box on the server side and we don't plan to support this use case for now. You may be able to polyfill the browser APIs that we use to make it work but we would not recommend that since the SDK behavior is tailored for a browser environment and constraints can be different on the server side. On your shoes, I would explore an approach with the browser SDK for the client side and the vercel integration for the backend side.
I'm guessing that you don't get this request often because of the nature of your clients being mostly enterprise level. They have the resources to dedicate to a problem like this. A small time like mine, though, would find a lot of value in a ready solution.
One solution you could build, if there's interest within Datadog, is to create another package similar to @datadog/browser-logs
called @datadog/node-logs
then ship both of these packages together in @datadog/js-logs
.
js-logs
would have the necessary logic to decide whether to send the logs through the browser API or the Node API depending on which environment it gets called.
By the way, Pino can be run in both client and server.
Anyways, I understand where you're coming from. I just wanted to share some thoughts. Thanks!
I have an isomporphic/universal Vercel app where I'd like to send/collect logs manually. Can this library be used for that?