<commit_before>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(){<commit_msg>fix(view-spy): change behavior of value-less attr to only log created<commit_after>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 && lifecycleName === 'created'){
      this.logger.info(lifecycleName, this.view);
    } else 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(){
{'fraction_non_alphanumeric': 0.1590909090909091, 'fraction_numerical': 0.001336898395721925, 'mean_word_length': 4.074576271186441, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5582883', 'n_tokens_mistral': 500, 'n_tokens_neox': 487, 'n_words': 90}