Chapter 7. Logging and event handling the Erlang/OTP way

 

This chapter covers

  • Erlang/OTP logging facilities and the SASL application
  • Event handling and the gen_event behaviour
  • Creating a custom event stream

So, you have the great little cache application you wrote in the previous chapter. It can store key/value pairs for quick retrieval, and it even evicts old entries automatically. It does this in a nice, clean way using various processes, supervisors, and tables. Although the implementation is tidy, a lot is going on within it: the application and the supervisor start up, worker processes come and go, data is stored and fetched, leases time out, and tables are manipulated. But to a user of the application, all this is taking place under the hood, and there is no simple way to find out more. If you were to ask, say, how many inserts took place over the last hour, you’d have no way of knowing. What’s more, if something went wrong, you’d have very little information about what happened.

7.1. Logging in Erlang/OTP

7.2. A custom event handler with gen_event

7.3. Adding a custom event stream to the Simple Cache

7.4. Summary

sitemap