Skip to content

Conversation

@ylecuyer
Copy link
Contributor

This PR allows to have a custom formatter for logs through a log_formatter dsl inside the configuration file

Example with a new rails app and no log_formatter:

=> Booting Puma
=> Rails 5.2.3 application starting in development 
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.12.1 (ruby 2.5.5-p157), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop

With the config :

log_formatter do |str|
  "[#{Process.pid}] [#{Socket.gethostname}] #{Time.now}: #{str}"
end
=> Booting Puma
=> Rails 5.2.3 application starting in development 
=> Run `rails server -h` for more startup options
[25473] [ylecuyer-U32U] 2019-06-10 22:29:43 +0200: Puma starting in single mode...
[25473] [ylecuyer-U32U] 2019-06-10 22:29:43 +0200: * Version 3.12.1 (ruby 2.5.5-p157), codename: Llamas in Pajamas
[25473] [ylecuyer-U32U] 2019-06-10 22:29:43 +0200: * Min threads: 5, max threads: 5
[25473] [ylecuyer-U32U] 2019-06-10 22:29:43 +0200: * Environment: development
[25473] [ylecuyer-U32U] 2019-06-10 22:29:43 +0200: * Listening on tcp://localhost:3000
[25473] [ylecuyer-U32U] 2019-06-10 22:29:43 +0200: Use Ctrl-C to stop

@ylecuyer
Copy link
Contributor Author

@nateberkopec can't this PR be included in the incoming 4.0.1 release ?

@nateberkopec
Copy link
Member

That wouldn't be very SemVer of me, would it? 😆

@nateberkopec
Copy link
Member

Thanks for keeping this updated, I think we can get it in w/4.1.

@ylecuyer
Copy link
Contributor Author

OK great to hear thanks

@nateberkopec
Copy link
Member

I'm cool with this. Needs a test.

@nateberkopec nateberkopec added the waiting-for-changes Waiting on changes from the requestor label Jul 16, 2019
@nateberkopec
Copy link
Member

Still needs a test here if it will get into 4.1

@ylecuyer ylecuyer force-pushed the log_formatter_config branch from cbe6da9 to 267d6c7 Compare July 28, 2019 15:27
@ylecuyer
Copy link
Contributor Author

I have added some tests

Copy link
Member

@MSP-Greg MSP-Greg left a comment

Choose a reason for hiding this comment

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

It's not my call, but maybe in the future use

skip NO_FORK_MSG unless HAS_FORK

Prefer 'feature skips' to 'platform skips'...

@nateberkopec nateberkopec removed the waiting-for-changes Waiting on changes from the requestor label Jul 28, 2019
@nateberkopec nateberkopec added this to the 4.1.0 milestone Jul 31, 2019
@nateberkopec nateberkopec merged commit b0c56db into puma:master Aug 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants