Can someone please tell me if this is code from facebook or from being hacked

Looks legit to me. is Facebook Content Distrbution Network.

Depends on the context. What were you doing when you took that screenshot?

I actually deleted the other pictures with it. Buy further on it was saying cavalry logger. Is that a key logger?

The CavalryLogger appears to be from Facebook, not that it necessarily makes it much better. Nor should the fact that Facebook would do tracking come as any surprise.

Nobody here can give you any guaranties, especially not based on a screenshot. But going by what we have seen so far there is nothing that points to malware.