pretty printing of records

Mikael Karlsson mikael.karlsson@REDACTED
Thu Aug 11 08:44:57 CEST 2005


Thanks for all suggestions,
looks as there are a number of solutions.
What I forgot to mention was that a precondition was that my records
are defined in a number of .hrl files, some quite large, generated by the 
asn1 compiler, so "hand coding" of record_info for every record was not
an option. I also do not know before reception which of all possible messages 
(records) I will receive.
What was nice with the shell commands was that I just could do:
rr("../include/*.hrl).
A=receive_any_message_defined_as_a_record_in_hrl_with_records_in_it().
rp(A).

What I wan't to achieve is a good lookin log formatting for messages 
directly from my program and not from the shell, so if one could add 
a function call for the shell command rr("..") too, to Ulf Wigers solution:
http://www.erlang.org/ml-archive/erlang-questions/200505/msg00201.html
then everything would be in place I think.

Or maybe  the jungerl the solution in (lib/msc/src/rec_info.erl) suggested 
by Vlad could work if I include all .hrl files in the module calling 
rec_info:to_list/2. I do not know how the compiler works here though, will 
it include all record definitions from the source code in the beam file, or
will it strip of the ones not used in the code?
Seems it that it can take a list of source (.hrl ?) files as well so that means
it would work.

Thanks
Mikael




More information about the erlang-questions mailing list