Skip to content
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

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

Conversation

ThisIsMissEm
Copy link

πŸ”— Linked issue

None, as this is a very small change.

❓ Type of change

  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to 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

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@thetutlage
Copy link
Member

The types are already imported from this subpath

"./types": "./build/src/types.js",

@ThisIsMissEm
Copy link
Author

@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
Copy link
Member

You can access it like that :

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

@Julien-R44
Copy link
Member

@ThisIsMissEm can we close this ?

@ThisIsMissEm
Copy link
Author

Sure

@ThisIsMissEm ThisIsMissEm deleted the feat/export-type-for-levels branch June 2, 2024 15:17
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.

3 participants