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

Allow to define a custom formatter for logs #1816

Merged
merged 15 commits into from Aug 1, 2019

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
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'...

lib/puma/launcher.rb Outdated Show resolved Hide resolved
History.md Outdated Show resolved Hide resolved
test/test_events.rb Outdated Show resolved Hide resolved
test/test_cli.rb Outdated Show resolved Hide resolved
lib/puma/launcher.rb Outdated Show resolved Hide resolved
lib/puma/launcher.rb Outdated Show resolved Hide resolved
@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.

None yet

3 participants