Add diagnostic util

Add several utility functions and classes for diagnostis messages