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

How to write v2.LogEntry Protobufs #1298

Closed
KaoruDev opened this issue Mar 10, 2023 · 5 comments · Fixed by #1509
Closed

How to write v2.LogEntry Protobufs #1298

KaoruDev opened this issue Mar 10, 2023 · 5 comments · Fixed by #1509
Assignees
Labels
api: logging Issues related to the googleapis/java-logging API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@KaoruDev
Copy link

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Is your feature request related to a problem? Please describe.
I'm trying to write logs in the shape of com.google.logging.v2.LogEntry. However, the #write expects com.google.logging.LogEntry.

Describe the solution you'd like
Reasonable options might be:

  1. an easy way to convert com.google.logging.v2.LogEntry into com.google.logging.LogEntry.
  2. overloaded #write method that accepts com.google.logging.v2.LogEntry.

Describe alternatives you've considered
I'm writing my own converter 😭

Additional context
Sorry, if this method already exists, could you please point me to the docs?

@product-auto-label product-auto-label bot added the api: logging Issues related to the googleapis/java-logging API. label Mar 10, 2023
@KaoruDev
Copy link
Author

Ah I see there's already a function for this:

static final Function<com.google.logging.v2.LogEntry, LogEntry> FROM_PB_FUNCTION =
(com.google.logging.v2.LogEntry pb) -> {
return fromPb(pb);
};

If I open a PR to add an overloaded write method to convert v2.LogEntry to logging.LogEntry using this function, would that be acceptable?

@losalex losalex added type: question Request for information or clarification. Not an issue. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Mar 11, 2023
@meredithslota meredithslota added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed type: question Request for information or clarification. Not an issue. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Apr 12, 2023
@losalex
Copy link
Contributor

losalex commented Jun 27, 2023

Sure @KaoruDev , feel free to open a PR to expose this function. Just one note - I guess for more universal use, instead of adding extra write method, perhaps we could expose converter functions, e.g. LogEntry.fromPbFunction and LogEntry.toPbFunction.

@losalex losalex removed their assignment Jul 3, 2023
@cindy-peng cindy-peng self-assigned this Jan 3, 2024
@cindy-peng
Copy link
Contributor

Hi @KaoruDev, just want to follow up, are you still interested in adding extra write method for com.google.logging.v2.LogEntry here? Or the current FROM_PB_FUNCTION is sufficient?

@KaoruDev
Copy link
Author

KaoruDev commented Jan 5, 2024

hey @cindy-peng -- we've since moved away from using this library. I likely won't be able to contribute for the foreseeable future 😞

@cindy-peng
Copy link
Contributor

No worries @KaoruDev! Thanks for reporting the issue. As discussed, for a more general using purpose, I have expose converter functions in this PR: #1509

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the googleapis/java-logging API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants