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: define bin.js #24

Closed
wants to merge 1 commit into from
Closed

feat: define bin.js #24

wants to merge 1 commit into from

Conversation

erfanium
Copy link

@erfanium erfanium commented May 27, 2023

fixes #23

Checklist

@@ -9,8 +9,14 @@
"example": "examples",
"test": "test"
},
"bin": {
"one-line-logger": "./bin.js"
Copy link
Author

Choose a reason for hiding this comment

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

should i use one-line-logger name here or something else? @fastify/one-time-logger is not a valid bin name

Copy link
Member

Choose a reason for hiding this comment

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

I think simplicity and fast to type thing is better:

  • 1l
  • 1line

@@ -24,11 +24,10 @@ tap.beforeEach(() => {
})

test('should log server started messages', async (t) => {
await server.listen({ port: 63995 })
await server.listen({ port: 63995, host: '127.0.0.1' })
Copy link
Author

@erfanium erfanium May 27, 2023

Choose a reason for hiding this comment

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

I changed this, because the previous code was not os-independent.
e.g. ipv6 may not be available.

@@ -52,6 +53,8 @@ const mockTime = () => {

// eslint-disable-next-line
Date.prototype.getHours = () => HOUR;
// eslint-disable-next-line
Date.prototype.getMinutes = () => MIN;
Copy link
Author

@erfanium erfanium May 27, 2023

Choose a reason for hiding this comment

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

getMinutes also should be mocked. otherwise tests will won't pass on some timezones. (e.g: +00:30 ,+01:30. +02:30 ...)

Copy link
Contributor

Choose a reason for hiding this comment

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

Add please corresponding unmock code to unmockTime

@erfanium
Copy link
Author

erfanium commented Nov 30, 2023

@Uzlopak
Sorry, after this, I have made my own tool fastify-pretty-log.
It's written in rust and can be used in environments without need to install nodejs. so i'm not really gonna to finish this.

feel free to close it

@mcollina mcollina closed this Dec 26, 2023
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.

one-line-logger as a executable program
4 participants