Skip to content

Commit

Permalink
improved logging
Browse files Browse the repository at this point in the history
  • Loading branch information
naueramant committed Aug 18, 2020
1 parent 1764b55 commit 27b6b9d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/simple.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
syntax: v1

tabs:
- url: https://xkcd.com/
- url: https://xkcd.com/
8 changes: 5 additions & 3 deletions internal/jobs/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ func NewJobScheduler(config config.Configuration, browserManager browser.Browser
}

func (s *JobScheduler) Start() {
for _, j := range s.Config.Jobs {
for i, j := range s.Config.Jobs {
s.Cron.AddFunc(j.When, func() {
s.run(j)
s.run(i, j)
})
}

Expand All @@ -38,7 +38,9 @@ func (s *JobScheduler) Stop() {
s.Cron.Stop()
}

func (s *JobScheduler) run(j config.Job) {
func (s *JobScheduler) run(i int, j config.Job) {
logrus.Infof("Executing job %d", i)

switch j.Type {
case "message":
s.runFlashMessage(j)
Expand Down
13 changes: 13 additions & 0 deletions screen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax: v1

tabs:
- url: https://xkcd.com/


jobs:
- type: command
when: "* * * * *"
options:
command: notify-send
args:
- "hej"

0 comments on commit 27b6b9d

Please sign in to comment.