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

Pull log 1.14.0 with it's no_net (no_http) #34

Merged
merged 4 commits into from
Jul 2, 2024
Merged

Conversation

ldemailly
Copy link
Member

@ldemailly ldemailly commented Jul 1, 2024

@ldemailly ldemailly requested a review from ccoVeille July 2, 2024 01:53
@ldemailly ldemailly merged commit cc842c6 into main Jul 2, 2024
3 checks passed
@ldemailly ldemailly deleted the no_net_no_json_doc branch July 2, 2024 01:54

### Small binaries

If you application doesn't do http request/response logging at all, use `-tags no_http` or `-tags no_net` (that one will also imply `no_tls_fallback`) and save 1.6 Mbytes in your binary's size (because the linker isn't smart enough to see net/http isn't actually used) (1.1Mbytes for log's no_http and 530k from the no_tls_fallback)

Choose a reason for hiding this comment

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

Nonblocking:

For constituency I would use, a space plus sane units

Suggested change
If you application doesn't do http request/response logging at all, use `-tags no_http` or `-tags no_net` (that one will also imply `no_tls_fallback`) and save 1.6 Mbytes in your binary's size (because the linker isn't smart enough to see net/http isn't actually used) (1.1Mbytes for log's no_http and 530k from the no_tls_fallback)
If you application doesn't do http request/response logging at all, use `-tags no_http` or `-tags no_net` (that one will also imply `no_tls_fallback`) and save 1.6 Mbytes in your binary's size (because the linker isn't smart enough to see net/http isn't actually used) (1.1 Mbytes for log's no_http and 530 kbytes from the no_tls_fallback)

or

Suggested change
If you application doesn't do http request/response logging at all, use `-tags no_http` or `-tags no_net` (that one will also imply `no_tls_fallback`) and save 1.6 Mbytes in your binary's size (because the linker isn't smart enough to see net/http isn't actually used) (1.1Mbytes for log's no_http and 530k from the no_tls_fallback)
If you application doesn't do http request/response logging at all, use `-tags no_http` or `-tags no_net` (that one will also imply `no_tls_fallback`) and save 1.6 MB in your binary's size (because the linker isn't smart enough to see net/http isn't actually used) (1.1 MB for log's no_http and 530 kB from the no_tls_fallback)


If you application doesn't do http request/response logging at all, use `-tags no_http` or `-tags no_net` (that one will also imply `no_tls_fallback`) and save 1.6 Mbytes in your binary's size (because the linker isn't smart enough to see net/http isn't actually used) (1.1Mbytes for log's no_http and 530k from the no_tls_fallback)

And, if you don't need any of the advanced JSON logging (which is quite likely with a cli), use `-tags no_json` the logger will still produce json structured logging just not as advanced if what you log are deep structures - this saves another 130k or so.

Choose a reason for hiding this comment

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

Suggested change
And, if you don't need any of the advanced JSON logging (which is quite likely with a cli), use `-tags no_json` the logger will still produce json structured logging just not as advanced if what you log are deep structures - this saves another 130k or so.
And, if you don't need any of the advanced JSON logging (which is quite likely with a cli), use `-tags no_json` the logger will still produce json structured logging just not as advanced if what you log are deep structures - this saves another 130 kB or so.

or

Suggested change
And, if you don't need any of the advanced JSON logging (which is quite likely with a cli), use `-tags no_json` the logger will still produce json structured logging just not as advanced if what you log are deep structures - this saves another 130k or so.
And, if you don't need any of the advanced JSON logging (which is quite likely with a cli), use `-tags no_json` the logger will still produce JSON structured logging just not as advanced if what you log are deep structures - this saves another 130 kbytes or so.


These tags are from [fortio.org/log](https://github.com/fortio/log) v1.14 and later

In summary: for smallest pure local cli binaries using this package:

Choose a reason for hiding this comment

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

Suggested change
In summary: for smallest pure local cli binaries using this package:
In summary: for smallest pure local CLI binaries using this package:

```
CGO_ENABLE=0 go build -trimpath -ldflags="-w -s" -tags no_net,no_json .
```
saves ~1.7Mbytes in total (a basic cli dependending on this package will then only be about 300k more as an hello world yet include color help, buildinfo, version, logging etc)

Choose a reason for hiding this comment

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

Suggested change
saves ~1.7Mbytes in total (a basic cli dependending on this package will then only be about 300k more as an hello world yet include color help, buildinfo, version, logging etc)
saves ~1.7 Mbytes in total (a basic CLI dependending on this package will then only be about 300 kbytes more as an hello world yet include color help, buildinfo, version, logging etc)
Suggested change
saves ~1.7Mbytes in total (a basic cli dependending on this package will then only be about 300k more as an hello world yet include color help, buildinfo, version, logging etc)
saves ~1.7 MB in total (a basic CLI dependending on this package will then only be about 300 kB more as an hello world yet include color help, buildinfo, version, logging etc)

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.

2 participants