Skip to content
  • Rasmus Dahlberg's avatar
    Automate handling of notice file · ad9fb496
    Rasmus Dahlberg authored
    Here's a hacky tool to migrate our ongoing v0.0.1 measurement once it's
    done.  I.e., just split-up the NOTICE prints we have in collect.stdout,
    putting them in per-log notice files that happens automatically now.
    
    ```
    // Package main provides a hacky tool that extracts NOTICE: <log desc> prints
    // from a file collect.stdout, putting them in the logs data directories as
    // notice.txt.  Only meant to migrate away from v0.0.1 that did not store
    // per-log notice files automatically, which makes things less error-prone.
    package main
    
    import (
    	"bytes"
    	"encoding/json"
    	"fmt"
    	logger "log"
    	"os"
    	"strings"
    
    	"gitlab.torproject.org/rgdd/ct/pkg/metadata"
    )
    
    func main() {
    	directory := "../data"
    	logDirectory := fmt.Sprintf("%s/logs", directory)
    	noticeFile := "../collect.stdout"
    
    	b, err := os.ReadFile(fmt.Sprintf("%s/metadata.json", directory))
    	if err != nil {
    		logger.Fatal(err)
    	}
    	var md metadata.Metadata
    	if err := json.Unmarshal(b, &md); err != nil {
    		logger.Fatal(err)
    	}...
    ad9fb496