changed position of level to be after timestamp#31
Open
nofun97 wants to merge 2 commits intoanz-bank:masterfrom
Open
changed position of level to be after timestamp#31nofun97 wants to merge 2 commits intoanz-bank:masterfrom
nofun97 wants to merge 2 commits intoanz-bank:masterfrom
Conversation
anzboi
reviewed
Feb 26, 2020
| message := strings.Builder{} | ||
| message.WriteString(entry.Time.Format(time.RFC3339Nano)) | ||
| message.WriteByte(' ') | ||
| sections := append(make([]string, 0, 5), entry.Time.Format(time.RFC3339Nano), strings.ToUpper(entry.Level.String())) |
Member
There was a problem hiding this comment.
Interesting idea, does this provide a performance improvement?
Contributor
Author
There was a problem hiding this comment.
it's really just because I was frustrated with managing the whitespaces though I remembered I tried comparing Join and using the Builder (my test was small) and there wasn't really any difference, at least with small cases.
Contributor
|
Please document the why in the description (and make sure it ends up in the commit message). |
Contributor
Author
|
@anzdaddy description updated |
anzdaddy
suggested changes
Mar 5, 2020
| message.WriteByte('\n') | ||
| return []byte(message.String()), nil | ||
| sections = append(sections, "\n") | ||
| return []byte(strings.Join(sections, " ")), nil |
Contributor
There was a problem hiding this comment.
This will incur a performance hit due to copying the final string into a byte array. Use bytes.Buffer instead. Maybe also NewBytesBuffer(make([]byte, 0, aReasonableDefaultCapacity)).
anzopensource
pushed a commit
that referenced
this pull request
May 12, 2023
* move to prod runner and fix tag action
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Standard format is now changed to
Also removed some dead code
The reason for the change is that, previously
levelis put afterfieldsand it is difficult to find the level as the number of fields varies. Putting it next totimestampsjust makes it easier to find.