You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
logging: Public API for setting timestamp, severity, etc. on Entry #1348
I can't find a public API for setting the metadata fields like timestamp and severity on a log entry.
It works to do var entry = log.entry(...); entry.severity = "INFO";, which is similar to what's done internally in Log.assignSeverityToEntries_, but I think there should be an options object argument in the Entry constructor.
Of the two, I think I like @stephenplusplus's proposal. The "resource" is already a bit confusing in nature, so it's nice to keep it explicitly separated. @stephenplusplus's is a breaking change though unless it's decided to keep supporting (resource, payload) in addition to the new ({resource, metadata}, payload).
The only downside of the three arguments is that both resource* and options are optional, so if we only receive 2 arguments, we couldn't safely detect which kind it is. Breaking change is unfortunate, but not a deal breaker.
*resource is optional because it can be specified at the time of the call to entry.write to apply to all of the entries given.
Activity
stephenplusplus commentedon Jun 1, 2016
An Entry already takes two objects, the first for the resource details, the second for the data.
We can change the
resourceargument tometadata:Which do you prefer?
// @callmehiphop for thoughts
callmehiphop commentedon Jun 1, 2016
Could we just add an optional
metadatafield to the resource itself?Or is that too weird?
zbjornson commentedon Jun 1, 2016
Of the two, I think I like @stephenplusplus's proposal. The "resource" is already a bit confusing in nature, so it's nice to keep it explicitly separated. @stephenplusplus's is a breaking change though unless it's decided to keep supporting
(resource, payload)in addition to the new({resource, metadata}, payload).zbjornson commentedon Jun 1, 2016
I was also thinking
(resource, options, payload), likestephenplusplus commentedon Jun 1, 2016
The only downside of the three arguments is that both
resource* andoptionsare optional, so if we only receive 2 arguments, we couldn't safely detect which kind it is. Breaking change is unfortunate, but not a deal breaker.*
resourceis optional because it can be specified at the time of the call toentry.writeto apply to all of the entries given.zbjornson commentedon Jun 1, 2016
Good point! Then my vote stays with
({resource, metadata}, payload). :)chore(main): release 7.5.2 (#1348)
chore: regenerate common templates (#1348)