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

debug string function should be implemented as in C++ and Python #12

Closed
ufechner7 opened this issue Mar 9, 2014 · 8 comments
Closed

Comments

@ufechner7
Copy link

The C++ and Python API define a human readable serialization of protobuf messages which is very useful for logging and debugging.

Example:
est_system_state { header { time_rel: 0.0 } pos_east: 1 pos_north: 2 height: 3 velocity_w { vx: 8 vy: 0.1 vz: 0 } }

The C++ API is described here:
https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.text_format?csw=1#TextFormat

The current string representation is hard to read and to understand:
EstimatedSystemState(StateHeader(0.0,0,false,559105,0.0,0.0),#undef,#undef,1.0f0,2.0f0,3.0f0,0.5f0,0.4f0,0.0f0,150.0f0,20.0f0,22.0f0,0.0f0,0.2f0,0.0f0,8.1783904f-38,20.0f0,Velocity_W(8.0f0,0.1f0,0.0f0),#undef,Heading_D(3.0f0,4.0f0),Course_D(4.0f0,5.0f0),false,#undef,#undef,#undef,8.3320624f-36)

The field names are missing, undefined fields appear, spaces are missing and the names of the messages are in camel case, which is not the case in the C++ or Python string representation (there camel case is automatically converted to words in small letters, using underscores between the letters).

@tanmaykm
Copy link
Member

tanmaykm commented Mar 9, 2014

Do you need this only for logging? Then till this is available here, you may want to look at what is provided by the JSON package (https://github.com/JuliaLang/JSON.jl).

@ufechner7
Copy link
Author

Well, using JSON is not really an option, because I have already 15 programs that communicate with protobuf encoded messages over ZeroMQ sockets. In addition I have already 14 GB of log files that use the debug string notation from protobuf (see: https://bitbucket.org/ufechner/juliaexperiments/src/bd4d49a5fc83ccfb52c92b0fef17971964ca4701/log/2012-06-14_13-49-55_ProtoLogger.txt?at=master )

Currently I analyse the log files with a mix of C++ and Python. Python alone is too slow, but maintaining the C++ code is cumbersome, I would like to do this task with Julia. But I cannot do that before the protobuf.text_format interface is implemented.
This is not very urgent, and I could help implementing it.

@tanmaykm
Copy link
Member

The primary hurdle in implementing this is the absence of any specifications. It needs digging through the C++ implementation to figure out the protocol. I will be able to take this up only after 2-3 weeks. Any help in implementing this is welcome!

@ufechner7
Copy link
Author

Is there already a function to convert an enum value into the corresponding string?

@tanmaykm
Copy link
Member

No, it's not there now. But it is possible to have some generic method to do this for all enums. Can you provide some examples/use cases?

@tanmaykm
Copy link
Member

tanmaykm commented Apr 3, 2014

The recently added lookup method can be used to convert an enum value to the corresponding name.

@daniter-cu
Copy link

Is there any update on if this will be implemented soon?

@Drvi
Copy link
Member

Drvi commented Aug 18, 2022

There seem to be multiple issues about text-format, closing this one in favor of #66. As a workaround, you can use protoc directly to translate between binary and text format, see this discourse post.

@Drvi Drvi closed this as completed Aug 18, 2022
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

No branches or pull requests

4 participants