pretty printing of records
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:
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:
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.
More information about the erlang-questions