In Canada and the USA, the general guideline is that unless you
are a law enforcement official operating under a warrant
(or under a security law that permits operation without a court order)
then placing a keylogger is a "wiretap" if you do not own the
equipment, and that even if you own the equipment, placing a keylogger
is a violation of civil rights unless *everyone* who uses the equipment
is made clearly aware of the existance of the keylogger.
That "everyone" -includes- unauthorized users
In Canada and the USA, cases have established that it is definitely
not legal to install a keylogger to -secretly- monitor what a spouse
or child is doing. "Secretly" is the operative word there.