seaflog

package module
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2021 License: MIT Imports: 13 Imported by: 1

README

seaflog

This package provides a command-line tool to parse SeaFlow v1 instrument log files as TSDATA format files.

Download binaries

Binaries for Linux and MacOS on x86_64 platforms are available from the releases page of this GitHub repo.

Build

This code requires Go 1.16 to build.

Using go install in Go 1.16+

go install github.com/seaflog-uw/seaflog@latest

From a local copy of this repo:

go build -o seaflog cmd/seaflog/main.go

Usage

seaflog \
    --filetype SeaFlowV1InstrumentLog \
    --project SeaFlow_740 --description "SeaFlow V1 Instrument Log events" \
    --logfile SFlog_740.txt \
    --outfile SFlog_740.tsv

See the output of seaflog --help for full usage.

Documentation

Overview

Package seaflog provides tools to process SeaFlow V1 instrument log files.

Index

Constants

This section is empty.

Variables

View Source
var EventDefs map[string]EventDef

EventDefs hold event defintions keyed by name.

Log is seaflog's logger

View Source
var Version string = "v0.1.4"

Functions

func Quiet

func Quiet(on bool)

Quiet turns off logging

func TimeFilter

func TimeFilter(event Event, earliest, latest time.Time) bool

TimeFilter returns true if an Event lies inclusively within the bounds of the times earliest and latest, and false otherwise. If earliest or latest are zero times they will be ignored.

Types

type Event

type Event struct {
	Name       string
	Type       string
	Line       string
	Value      interface{}
	Time       time.Time
	LineNumber int `json:"line_number"`
	Error      error
}

Event is parsed log file event

func CreateEvent

func CreateEvent(line string, t time.Time, lineNumber int) (event Event, err error)

CreateEvent creates an event

func UnhandledToNote

func UnhandledToNote(unhandled Event) Event

UnhandledToNote converts an unhandled event to a note event

type EventDef

type EventDef struct {
	Name       string
	Type       string
	EventForms []EventForm `json:"forms"`
}

EventDef defines a log file event

type EventExample

type EventExample struct {
	Text   string
	Parsed Event
}

EventExample contains example input and parsed data for an Event.

type EventForm

type EventForm struct {
	StartsWith  string `json:"startswith"`
	ValueAction string `json:"value_action"`
	Examples    []EventExample
}

EventForm defines a form of an event with a unique line prefix.

type EventScanner

type EventScanner struct {
	// contains filtered or unexported fields
}

EventScanner provides an interface for reading through a SeaFlow v1 instrument log file.

func NewEventScanner

func NewEventScanner(r io.Reader) *EventScanner

func (*EventScanner) Err

func (es *EventScanner) Err() error

Err returns any unrecoverable error encountered during event scanning.

func (*EventScanner) Event

func (es *EventScanner) Event() Event

func (*EventScanner) Scan

func (es *EventScanner) Scan() bool

Scan advances to the next event, which will then be available through the Event method. Returns false when the end of the input has been reached or after encountering an unrevorable error. This error which will be available with the Err method.

type TsdataWriter

type TsdataWriter struct {
	// contains filtered or unexported fields
}

TsdataWriter provides tools to write SeaFlow log files in TSDATA file format

func NewTsdataWriter

func NewTsdataWriter(fileType string, project string, description string) TsdataWriter

NewTsdataWriter creates a new TsdataWriter struct

func (TsdataWriter) EventText

func (t TsdataWriter) EventText(event Event) (string, error)

EventText returns a TSDATA event line string for one Event

func (TsdataWriter) HeaderText

func (t TsdataWriter) HeaderText() string

HeaderText returns a TSDATA header string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL