A Generalization of Poincaré and Log-Sobolev Inequalities