php - Global Logging method in MVC based web app -
i creating management/crm system.
i have class in libs folder called util contains static functions.
i want create static function logging user actions anywhere in scheme i.e.
util::log($userid, $action) ; the bit has me wondering how should pass info database need instantiate database class contained in class called model in libs folder.
what smoothest way this?
would improve create log class in controllers folder , have interface own logmodel class same way other non lib controllers do?
besides having static method let's phone call logging anywhere think if log table in db it's part of model, application must declare log class wich maps log instances in application , logmodel manage these instances.
i suppose static method must contain few rows of code
$l = new log(); $l->setuserid($userid); $l->setaction($action); $lm = new logmodel(); $lm->save($l); so utility of having not repeat above code in parts of application.
php model-view-controller model controller
No comments:
Post a Comment