Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugbar messages not working #40

Closed
cosmy81 opened this issue Dec 19, 2016 · 1 comment
Closed

Debugbar messages not working #40

cosmy81 opened this issue Dec 19, 2016 · 1 comment

Comments

@cosmy81
Copy link

cosmy81 commented Dec 19, 2016

HI, I have the debugbar working on my site, but the messages are not working.
The debugbar inizialization is:
(new Snowair\Debugbar\ServiceProvider(BASE_PATH . '/config/debugbar.php'))->start();
Then if I try to use it, nothing happens:

<?php
          $debugbar=$di->get('debugbar');
          $debugbar->startMeasure('start-1','how long');        // startMeasure($internal_sign_use_to_stop_measure, $label)
          $debugbar->addMeasurePoint('start');                  // measure the spent time from latest measurepoint to now.
          $debugbar->addMessage('this is a message', 'label');  // add a message using a custom label.
          $debugbar->info(ENVIRONMENT,SITENAME);  // add many messages once a time. See PSR-3 for other methods name.(debug,notice,warning,error,...)
          $debugbar->addMessageIfTrue('1 == "1"', 1=='1','custom_label'); // add message only when the second parameter is true
          $debugbar->addMessageIfTrue('will not show', 1=='0');
          $debugbar->addMessageIfFalse('1 != "0" ', 1=='0');       // add message only when the second parameter is false
          $debugbar->addMessageIfNull('condition is null', Null ); // add message only when the second parameter is NULL
          $condition='';
          $debugbar->addMessageIfEmpty('condition is emtpy', $condition ); // add message only when the second parameter is empty
          $debugbar->addMessageIfNotEmpty('condition is not emtpy', $condition=[1] ); // add message only when the second parameter is not empty
          $debugbar->addException(new \Exception('oh , error'));
          $debugbar->addMeasurePoint('stop');
          $debugbar->stopMeasure('start-1');                    // stopMeasure($internal_sign_use_to_stop_measure)

If I try inside volt template I receive an error:
{{ addMessage('test message','label') }}

Macro 'addMessage' does not exist

#0 /Users/cosmy/git/BraveNewSystem/cache/volt/weekendinitaly/%%users%%cosmy%%git%%bravenewsystem%%app%%frontend%%weekendinitaly%%views%%index%%index.volt.compiled(4): Phalcon\Mvc\View\Engine\Volt->callMacro('addMessage', Array)
#1 [internal function]: unknown()
#2 /Users/cosmy/git/BraveNewSystem/lib/extended/ExtendedView.php(63): Phalcon\Mvc\View\Engine\Volt->render('/Users/cosmy/gi...', Array, true)
#3 [internal function]: Extended\ExtendedView->_engineRender(Array, 'index/index', true, true, NULL)
#4 [internal function]: Phalcon\Mvc\View->render('index', 'index', Array)
#5 /Users/cosmy/git/BraveNewSystem/app/Bootstrap.php(155): Phalcon\Mvc\Application->handle()
#6 /Users/cosmy/git/BraveNewSystem/public/index.php(23): Bootstrap->run()
#7 {main}

@snowair
Copy link
Owner

snowair commented Apr 14, 2017

  1. enable the "view" collector
  2. delete all files in the "cache/volt" directory

then retry.

@snowair snowair closed this as completed Apr 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants