Get message from other modules
I am working on a logger module which stores text in a file. In this logger file Im trying to receive message from other modules in the same project. I have a controller that has a few outputs that is written to the shell. I don't want this output to be written to the shell instead i want this output to b开发者_开发知识库e able to send it to my logger module, and that module should afterwards write the output to a file.
The question is how should I write the code to receive this messages?
Thanks
Basically without any further detailed information I would think you want to create a event handler (gen_event behaviour) which is ideal for situations as logging, event handling (hence the name :) and such.
The same way you write code to receive any other message; with a receive
block.
精彩评论