<commit_before>package main

import (
	"encoding/json"
	"fmt"
	"log"
	"logyard"
	"logyard/stackato/events"
	"time"
)

// Make relevant cloud events available in application logs. Heroku style.
func MonitorCloudEvents() {
	// TODO: add more events; will require modifying the log
	// invokation to include the required app id
	filters := []string{
		"event.dea_start",
		"event.dea_ready",
		"event.dea_stop",
		"event.stager_start",
		"event.stager_end",
		"event.cc_app_update",
	}

	c, err := logyard.NewClientGlobal()
	if err != nil {
		log.Fatal(err)
	}
	ss, err := c.Recv(filters)
	if err != nil {
		log.Fatal(err)
	}

	log.Println("Listening for app relevant cloud events...")
	for msg := range ss.Ch {
		fmt.Println(msg.Key, msg.Value)
		var event events.Event
		err := json.Unmarshal([]byte(msg.Value), &event)
		if err != nil {
			log.Fatal(err) // not expected at all<commit_msg>apptail: remove debug logging<commit_after>package main

import (
	"encoding/json"
	"fmt"
	"log"
	"logyard"
	"logyard/stackato/events"
	"time"
)

// Make relevant cloud events available in application logs. Heroku style.
func MonitorCloudEvents() {
	// TODO: add more events; will require modifying the log
	// invokation to include the required app id
	filters := []string{
		"event.dea_start",
		"event.dea_ready",
		"event.dea_stop",
		"event.stager_start",
		"event.stager_end",
		"event.cc_app_update",
	}

	c, err := logyard.NewClientGlobal()
	if err != nil {
		log.Fatal(err)
	}
	ss, err := c.Recv(filters)
	if err != nil {
		log.Fatal(err)
	}

	log.Println("Listening for app relevant cloud events...")
	for msg := range ss.Ch {
		var event events.Event
		err := json.Unmarshal([]byte(msg.Value), &event)
		if err != nil {
			log.Fatal(err) // not expected at all
{'fraction_non_alphanumeric': 0.14261363636363636, 'fraction_numerical': 0.0, 'mean_word_length': 3.6710875331564985, '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': '5294574', 'n_tokens_mistral': 677, 'n_tokens_neox': 634, 'n_words': 170}