adonisjs / logger

AdonisJS Logger built on top of pino
https://docs.adonisjs.com/guides/logger
MIT License
23 stars 9 forks source link

feat: export type for LoggerLevel (pino.Level) from root module #67

Closed ThisIsMissEm closed 4 months ago

ThisIsMissEm commented 5 months ago

πŸ”— Linked issue

None, as this is a very small change.

❓ Type of change

πŸ“š Description

Whilst working on a kafka package for Adonis v6, I needed the ability to type a KAFKA_LOG_LEVEL value, which is the same as the Pino log levels. I thought I could just do:

import type { Level } from '@adonisjs/core/logger'

But this doesn't work, instead I'd need to add @adonisjs/logger as a devDependency and peerDependency to our project, instead of just relying on @adonisjs/core, and then change that type import to:

import type { Level } from '@adonisjs/logger/types'

I feel like the former is probably a more expected way to use this type, hence opening this pull request.

πŸ“ Checklist

thetutlage commented 5 months ago

The types are already imported from this subpath https://github.com/adonisjs/logger/blob/a90ad3c16d885b41fd97c9f6857efa5b8647f626/package.json#L14

ThisIsMissEm commented 5 months ago

@thetutlage yeah, the issue is that there's no way to access these types from the @adonisjs/core/logger import, hence adding the export here.

Julien-R44 commented 5 months ago

You can access it like that :

import type { Level } from '@adonisjs/core/types/logger'
Julien-R44 commented 4 months ago

@ThisIsMissEm can we close this ?

ThisIsMissEm commented 4 months ago

Sure