Code Monkey home page Code Monkey logo

Comments (8)

gnarea avatar gnarea commented on May 27, 2024 1

No worries at all! Glad you got to the bottom of it 👍🏾

from pino-cloud-js.

gnarea avatar gnarea commented on May 27, 2024

Please share the code you're using to configure pino @thelinuxlich

from pino-cloud-js.

thelinuxlich avatar thelinuxlich commented on May 27, 2024

Here it comes

import { getPinoOptions } from '@relaycorp/pino-cloud'
import pino from 'pino'
import pretty from 'pino-pretty'
export const logSettings =
	process.env.NODE_ENV === 'localhost'
		? pretty({
				colorize: true,
				colorizeObjects: true,
				translateTime: 'SYS:yyyy-mm-dd HH:MM:ss',
				ignore: 'pid,hostname',
			})
		: getPinoOptions('gcp', { name: 'rise' })
export const logger = pino(logSettings)

from pino-cloud-js.

gnarea avatar gnarea commented on May 27, 2024

It looks like NODE_ENV === 'localhost' on GCP. Are you sure that's not the case?

I've never seen this behaviour, and I use this lib on GKE and Cloud Run.

from pino-cloud-js.

thelinuxlich avatar thelinuxlich commented on May 27, 2024

oh the env variable is okay, otherwise I wouldn't receive the JSON format on Google and other things wouldn't work. It's really really weird

from pino-cloud-js.

gnarea avatar gnarea commented on May 27, 2024

The screenshot you shared is what I'd expect to see if pretty(...) was being used. Log entries are always shown as JSON documents on Google Logging, but note that textPayload is a string.

Please try this:

import { getPinoOptions } from '@relaycorp/pino-cloud'
import pino from 'pino'

export const logSettings = getPinoOptions('gcp', { name: 'rise' })
export const logger = pino(logSettings)

from pino-cloud-js.

thelinuxlich avatar thelinuxlich commented on May 27, 2024

Another proof is that when logging to localhost, pino-pretty doesn't have that severity property, maybe I need to configure something on GCP to convert this to structured logging and this has nothing to do with the library...

from pino-cloud-js.

thelinuxlich avatar thelinuxlich commented on May 27, 2024

Solved it, it was my Dockerfile running the service with turbo and Turbo adds a prefix, I feel so dumb, sorry for taking your attention for nothing

from pino-cloud-js.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.