Implement the log() function.

Refs #5846
Allow values as top-level statements.

Refs #5846