(I'm assuming Linux here)
You can write code to get notifications when there are modifications to a directory but I don't know of a way to get notifications when someone enters it. Though, what would be the point? If you are concerned with those who saw what was in there you'd also need to be notified on other situations ( ls -l comes to mind).
Even if you modified cd itself to do the logging, what happens in other situations like pushd , or ln -s to that directory?
Monitor the parent directory. Entering the target directory modifies atime, so watching for IN_ATTRIB pretty much accomplishes the task.
Is there some facility that does this for you - as in you can request asynchronous notification - or are you suggesting a hand-rolled solution? F_NOTIFY has DN_ACCESS and DN_ATTRIB but they dont seem to work for me on just cd into the directory (or subdirectory). I'd be interested in what you are suggesting.
Try Dtrace. You shoudl be able to add some hook into kernel to monitor directory access and log if the directory in question == xyz.
Only port for linux I saw was from CRiSP available here.
Check status.txt for compatibility with your OS/version.
If you can make it run, then attached example (downloaded from here) can help you find how to write a script that will do what you want.