04-20-2016, 10:44 AM
Just off the top of my head I would probably add a "type" parameter
Then in the write log method I could make it do all kinds of special magic based on the type.
For example run a debug_backtrace() and grab all kinds of stuff about who called you as well as anything available to the CI Input Class, URI Class objects, User Agent Class, Session Library, etc...
this might grab the database stats or something since you specified it as a model type?
Do nothing special but log that entry.
That of course could also be a column in itself called "type" which you could filter on later.
You could also just send in a instance of who ever is calling the method ie.
Then you could look at the $this parameter in the method and determine what to do? Everything (public) available to the caller would be available to the writelog method.
DMyers
Code:
$this->mylog_model->writelog('controller','Read Active Customer IDs');
Then in the write log method I could make it do all kinds of special magic based on the type.
For example run a debug_backtrace() and grab all kinds of stuff about who called you as well as anything available to the CI Input Class, URI Class objects, User Agent Class, Session Library, etc...
Code:
$this->mylog_model->writelog('model','Read Blog Entry');
this might grab the database stats or something since you specified it as a model type?
Code:
$this->mylog_model->writelog('generic','Read Blog Entry 23');
Do nothing special but log that entry.
That of course could also be a column in itself called "type" which you could filter on later.
You could also just send in a instance of who ever is calling the method ie.
Code:
$this->mylog_model->writelog($this,'Do Something');
Then you could look at the $this parameter in the method and determine what to do? Everything (public) available to the caller would be available to the writelog method.
DMyers