Start of daemon (not working) [CI SKIP]

This commit is contained in:
Jef Roosens 2022-04-13 15:24:55 +02:00
parent 132a7a8ba5
commit ff57d73998
Signed by untrusted user: Jef Roosens
GPG key ID: B75D4F293C7052DB
6 changed files with 111 additions and 11 deletions

View file

@ -2,17 +2,23 @@ module cron
import git
import time
struct ScheduledBuild {
repo git.GitRepo
timestamp time.Time
}
fn (r1 ScheduledBuild) < (r2 ScheduledBuild) bool {
return r1.timestamp < r2.timestamp
}
import log
import util
import cron.daemon
// cron starts a cron daemon & starts periodically scheduling builds.
pub fn cron(conf Config) ? {
println('WIP')
// Configure logger
log_level := log.level_from_tag(conf.log_level) or {
util.exit_with_message(1, 'Invalid log level. The allowed values are FATAL, ERROR, WARN, INFO & DEBUG.')
}
mut logger := log.Log{
level: log_level
}
logger.set_full_logpath(conf.log_file)
logger.log_to_console_too()
d := daemon.init(conf)
}