import {customAttribute} from 'aurelia-templating';
import {inject} from 'aurelia-dependency-injection';
import * as LogManager from 'aurelia-logging';

@customAttribute('view-spy')
export class ViewSpy {
  constructor(){
    this.logger = LogManager.getLogger('view-spy');
  }

  log(lifecycleName, context){
    if(!this.value || this.value.indexOf(lifecycleName) !== -1){
      this.logger.info(lifecycleName, this.view, context);
    }
  }

  created(view){
    this.view = view;
    this.log('created');
  }

  bind(bindingContext){
    this.log('bind', bindingContext);
  }

  attached(){
    this.log('attached');
  }

  detached(){
    this.log('detached');
  }

  unbind(){
    this.log('unbind');
  }
}

@@ -326,10 +326,118 @@
 lue 
-%7C%7C
+&& lifecycleName === 'created')%7B%0A      this.logger.info(lifecycleName, this.view);%0A    %7D else if(this.value &&
  thi

change behavior of value-less attr to only log created