Documentation
¶
Index ¶
- Variables
- func DayCutoff(days int) time.Time
- func ExtractTimestamp(line string) (time.Time, bool)
- func FilterBlocksByDays(content string, days int) string
- func FilterBlocksByProfile(content string, profile string) (string, int)
- func KindString(k EntryKind) string
- func Log(action string, steps []config.Step, afk bool, vars tmpl.Vars, desktop *int)
- func LogCooldown(profile, action string, cooldownSeconds int)
- func LogCooldownRecord(profile, action string, cooldownSeconds int)
- func LogSilent(profile, action string)
- func LogSilentDisable()
- func LogSilentEnable(d time.Duration)
- func SplitBlocks(content string) []string
- func StepSummary(s config.Step, vars *tmpl.Vars) string
- type ActionKey
- type AggregatedData
- type Counts
- type DayGroup
- type DaySummary
- type Entry
- type EntryKind
- type HourProfile
- type HourlyData
- type TimeSpentData
- type TimeSpentProfile
- type VoiceLine
Constants ¶
This section is empty.
Variables ¶
var LogPath = func() string { return filepath.Join(paths.DataDir(), paths.LogFileName) }
LogPath returns the log file location:
- Windows: %APPDATA%\notify\notify.log
- Unix: ~/.config/notify/notify.log
This is a variable so tests can override it.
Functions ¶
func DayCutoff ¶ added in v0.2.29
DayCutoff returns midnight N days ago (inclusive) in the local timezone. For days=1 it returns today at midnight, for days=7 it returns 6 days ago, etc.
func ExtractTimestamp ¶ added in v0.2.17
ExtractTimestamp parses the RFC3339 timestamp at the start of a log line (everything before the first " " double-space separator). Returns the parsed time and true on success, or zero time and false on failure.
func FilterBlocksByDays ¶ added in v0.2.26
FilterBlocksByDays returns only log blocks whose timestamp falls within the last N calendar days. Each block is separated by a blank line.
func FilterBlocksByProfile ¶ added in v0.2.28
FilterBlocksByProfile removes all log blocks belonging to the named profile. Returns the filtered content and the number of removed blocks.
func KindString ¶ added in v0.2.12
KindString returns a human-readable string for an EntryKind.
func Log ¶
Log appends to the log file a summary line followed by one detail line per step. Errors are printed to stderr but never returned — logging is best-effort.
func LogCooldown ¶ added in v0.2.3
LogCooldown appends a single line noting that an invocation was skipped due to cooldown. Best-effort, same as Log.
func LogCooldownRecord ¶ added in v0.2.3
LogCooldownRecord appends a single line noting that cooldown state was updated for an action. Best-effort, same as Log.
func LogSilent ¶ added in v0.2.7
func LogSilent(profile, action string)
LogSilent appends a single line noting that an invocation was skipped due to silent mode. Best-effort, same as Log.
func LogSilentDisable ¶ added in v0.2.7
func LogSilentDisable()
LogSilentDisable appends a single line noting that silent mode was disabled. Best-effort, same as Log.
func LogSilentEnable ¶ added in v0.2.7
LogSilentEnable appends a single line noting that silent mode was enabled. Best-effort, same as Log.
func SplitBlocks ¶ added in v0.2.29
SplitBlocks splits log content on blank lines, trims whitespace from each block, and returns only non-empty blocks.
func StepSummary ¶ added in v0.2.17
StepSummary returns a human-readable description of what a step does. When vars is non-nil, template variables are expanded (logging mode). When vars is nil, raw values are shown (dry-run mode). When/volume suffixes are always appended if present.
Types ¶
type ActionKey ¶ added in v0.2.21
type ActionKey struct{ Profile, Action string }
ActionKey identifies a profile/action pair for aggregation.
type AggregatedData ¶ added in v0.2.21
type AggregatedData struct {
PerAction map[ActionKey]*Counts
PerProfile map[string]*Counts
ProfileOrder []string
ActionsByProfile map[string][]ActionKey
HasSkipped bool
}
AggregatedData holds the result of aggregating day groups into per-action and per-profile counts.
func AggregateGroups ¶ added in v0.2.21
func AggregateGroups(groups []DayGroup) AggregatedData
AggregateGroups collects per-action and per-profile counts from day groups.
type Counts ¶ added in v0.2.21
type Counts struct{ Exec, Skip int }
Counts holds execution and skip totals for a profile or action.
type DayGroup ¶ added in v0.2.11
type DayGroup struct {
Date time.Time
Summaries []DaySummary
}
DayGroup holds all summaries for a single calendar day.
func SummarizeByDay ¶ added in v0.2.11
SummarizeByDay filters entries to the last N calendar days (local time), groups by date + profile/action, and returns day groups sorted descending with summaries sorted alphabetically. Pass days=0 to include all entries.
type DaySummary ¶ added in v0.2.11
DaySummary holds execution and skip counts for one profile/action pair.
type Entry ¶ added in v0.2.11
type Entry struct {
Time time.Time
Profile string
Action string
Kind EntryKind
ClaudeHook string // from claude_hook= field (optional)
ClaudeMessage string // from claude_message= field (optional)
}
Entry is a single parsed log entry.
func ParseEntries ¶ added in v0.2.11
ParseEntries splits log content on blank lines and parses summary lines into entries. Each block may contain multiple summary lines (e.g. a cooldown=recorded line followed by an execution line) plus step detail lines (indented with "step["). Step detail lines are skipped. Each summary line produces one Entry. Malformed lines are silently skipped.
type HourProfile ¶ added in v0.2.21
HourProfile is the key for per-cell hourly data.
type HourlyData ¶ added in v0.2.21
type HourlyData struct {
Profiles []string
PerCell map[HourProfile]int
PerHour map[int]int
ProfileTotals []int // parallel to Profiles
MinHour int
MaxHour int
GrandTotal int
}
HourlyData holds computed hourly breakdown data for a single day.
func ComputeHourly ¶ added in v0.2.21
ComputeHourly computes per-hour activity breakdown for a target date. Only entries matching targetDate in the given location are included. Entries with KindOther are excluded.
type TimeSpentData ¶ added in v0.2.21
type TimeSpentData struct {
Profiles []TimeSpentProfile
Total int
}
TimeSpentData holds approximate time spent across all profiles.
func ComputeTimeSpent ¶ added in v0.2.21
ComputeTimeSpent estimates approximate time spent per profile on a target date. It walks consecutive entry timestamps per profile; gaps of 5 minutes or less are counted as active time.
type TimeSpentProfile ¶ added in v0.2.21
TimeSpentProfile holds approximate time spent for one profile.
type VoiceLine ¶ added in v0.2.23
VoiceLine holds a unique voice step text and its usage count.
func ParseVoiceLines ¶ added in v0.2.23
ParseVoiceLines scans log content for TTS step detail lines and returns unique texts sorted by frequency (descending), then alphabetically.