1
0
Fork 0
mirror of https://github.com/Luzifer/gallery.git synced 2024-12-23 03:11:23 +00:00
gallery/storage_log.go

31 lines
759 B
Go
Raw Permalink Normal View History

2018-04-28 16:51:55 +00:00
package main
import (
"bytes"
"io"
"io/ioutil"
log "github.com/sirupsen/logrus"
)
type logStorage struct{}
// WriteFile takes the content of a file and writes it into the underlying
// storage system.
func (l logStorage) WriteFile(filepath string, content io.Reader, contentType string) error {
log.WithFields(log.Fields{
"path": filepath,
"content_type": contentType,
}).Info("Write file")
return nil
}
// ReadFile retrieves a file from the underlying storage, needs to return
// errFileNotFound when file is not present.
func (l logStorage) ReadFile(filepath string) (io.ReadCloser, error) {
log.WithFields(log.Fields{
"path": filepath,
}).Info("Read file")
return ioutil.NopCloser(bytes.NewReader([]byte{})), errFileNotFound
}