debug logs and b64 non encodable

This commit is contained in:
bel
2020-04-08 02:25:24 +00:00
parent cc6b6f9226
commit 84400e4401
9 changed files with 25 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ import (
"local/firestormy/config"
"local/firestormy/config/ns"
"local/firestormy/logger"
"local/logb"
"os/exec"
"strings"
"time"
@@ -53,6 +54,7 @@ func newBashJob(schedule, sh string, title ...string) (*Job, error) {
j.Title = title[0]
}
j.foo = func() {
logb.Debugf("[sched] run %s/%s? %v", j.Title, j.Name, j.Disabled)
if j.Disabled {
return
}

View File

@@ -8,6 +8,7 @@ import (
"local/firestormy/config"
"local/firestormy/config/ns"
"local/firestormy/logger"
"local/logb"
"regexp"
"strings"
"time"
@@ -111,6 +112,7 @@ func (s *Scheduler) Start() error {
}
s.cron.Start()
entries := s.cron.Entries()
logb.Debugf("[sched] start: %+v", entries)
logger.New().Info("started", len(entries), "jobs")
for _, entry := range entries {
logger.New().Info(fmt.Sprintf("%+v", entry))
@@ -126,6 +128,7 @@ func (s *Scheduler) Stop() error {
func (s *Scheduler) List() ([]*Job, error) {
entries, err := config.Store.List(ns.Jobs)
logb.Debugf("[sched] list: %+v", entries)
if err != nil {
return nil, err
}
@@ -157,6 +160,7 @@ func (s *Scheduler) loadJobFromStore(k string) (*Job, error) {
}
func (s *Scheduler) Update(j *Job) error {
logb.Debugf("[sched] update: %+v", j)
entryID, ok := s.getEntry(j)
if !ok {
return errors.New("job not found in storage")
@@ -191,6 +195,7 @@ func (s *Scheduler) Update(j *Job) error {
}
func (s *Scheduler) Add(j *Job) error {
logb.Debugf("[sched] add: %+v", j)
if _, ok := s.getEntry(j); ok {
return ErrDuplicateJob
}
@@ -210,6 +215,7 @@ func (s *Scheduler) Add(j *Job) error {
}
func (s *Scheduler) Remove(j *Job) error {
logb.Debugf("[sched] rm: %+v", j)
entryID, ok := s.getEntry(j)
if !ok {
return ErrJobNotFound