21278 Posts in 5728 Topics by 2599 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1274 Views |
-
Some answers please

21 May 2010 at 4:19pm
Hi,
How can I disable the javascript validation of forms automagically inserted by swilverstripe? Reason being, I would like to control the javascripts included on each page on the site and include only the libraries I want basically.
How can I log data while I'm developing and testing? I don't necessarily want to display the data on screen, just log data basically. I'd love the ability to log entire objects and run tail -f error.log to see variable values etc. while I'm developing without messing up the display of the site.
Thanks
-
Re: Some answers please

21 May 2010 at 8:26pm Last edited: 21 May 2010 8:27pm
Hi Frank, Welcome to the forums
You can disable js validation by setting this in your _config.php file.
Validator::set_javascript_validation_handler('none');
Logging data depends what version of SS your using. In 2.4 debug logging has a totally new setup you can use. Use the SS_Log class to write to a file. So first you define your writer in your config file.
SS_Log::add_writer(new SS_LogFileWriter('errors.log'));
Then you can write to the log.
SS_Log::log("This is something to log");
What you pass to that could be something like Debug::show($object) or a print_r($object) which will output the object or you can do specific values.
-
Re: Some answers please

22 June 2010 at 5:28pm Last edited: 22 June 2010 7:13pm
Example of logging a basic message, need to pass Exception or an Array with following possible keys
//Logging
SS_Log::add_writer(new SS_LogFileWriter('/var/www/silverstripe/mysite/errors.log'));
SS_Log::log(new Exception('Some log message here'), SS_Log::NOTICE);$message = array(
'errno' => '',
'errstr' => 'Testing',
'errfile' => '',
'errline' => '',
'errcontext' => ''
);
SS_Log::log($message, SS_Log::NOTICE); -
Re: Some answers please

22 June 2010 at 6:07pm Last edited: 22 June 2010 7:05pm
Nothing to see here.
| 1274 Views | ||
|
Page:
1
|
Go to Top |


