Add packet logging code