mirror of
https://github.com/ncarlier/webhookd.git
synced 2025-04-08 01:36:13 +00:00

- URL based configuration - Only prefixed output lines are notified - HTTP notifier: send a JSON with notification in the text attribute - SMTP notifier: send an email with notification text in body
26 lines
555 B
Go
26 lines
555 B
Go
package worker
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path"
|
|
"path/filepath"
|
|
|
|
"github.com/ncarlier/webhookd/pkg/config"
|
|
"github.com/ncarlier/webhookd/pkg/tools"
|
|
)
|
|
|
|
// RetrieveLogFile retrieve work log with its name and id
|
|
func RetrieveLogFile(id, name string) (*os.File, error) {
|
|
logPattern := path.Join(*config.Get().LogDir, fmt.Sprintf("%s_%s_*.txt", tools.ToSnakeCase(name), id))
|
|
files, err := filepath.Glob(logPattern)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if len(files) > 0 {
|
|
filename := files[len(files)-1]
|
|
return os.Open(filename)
|
|
}
|
|
return nil, nil
|
|
}
|