@@ -40,7 +40,9 @@ import (
40
40
var defaultFilePerm = os .FileMode (0664 )
41
41
42
42
func (fs * localfs ) Upload (ctx context.Context , ref * provider.Reference , r io.ReadCloser , metadata map [string ]string ) error {
43
+ log := appctx .GetLogger (ctx )
43
44
upload , err := fs .GetUpload (ctx , ref .GetPath ())
45
+ log .Info ().Any ("upload" , upload ).Msg ("localfs: upload" )
44
46
if err != nil {
45
47
return errors .Wrap (err , "localfs: error retrieving upload" )
46
48
}
@@ -156,6 +158,7 @@ func (fs *localfs) NewUpload(ctx context.Context, info tusd.FileInfo) (upload tu
156
158
info .ID = uuid .New ().String ()
157
159
158
160
binPath , err := fs .getUploadPath (ctx , info .ID )
161
+ log .Info ().Str ("upload-path" , binPath ).Err (err ).Msg ("localfs: got upload path" )
159
162
if err != nil {
160
163
return nil , errors .Wrap (err , "localfs: error resolving upload path" )
161
164
}
@@ -307,6 +310,7 @@ func (upload *fileUpload) writeInfo() error {
307
310
308
311
// FinishUpload finishes an upload and moves the file to the internal destination.
309
312
func (upload * fileUpload ) FinishUpload (ctx context.Context ) error {
313
+ log := appctx .GetLogger (ctx )
310
314
np := upload .info .Storage ["InternalDestination" ]
311
315
312
316
// TODO check etag with If-Match header
@@ -318,6 +322,7 @@ func (upload *fileUpload) FinishUpload(ctx context.Context) error {
318
322
//}
319
323
320
324
// if destination exists
325
+ log .Info ().Str ("oldpath" , upload .binPath ).Str ("newpath" , np ).Msg ("localfs: FinishUpload" )
321
326
if _ , err := os .Stat (np ); err == nil {
322
327
// create revision
323
328
if err := upload .fs .archiveRevision (upload .ctx , np ); err != nil {
@@ -327,6 +332,7 @@ func (upload *fileUpload) FinishUpload(ctx context.Context) error {
327
332
328
333
err := os .Rename (upload .binPath , np )
329
334
if err != nil {
335
+ log .Error ().Msg ("localfs: Failed to rename in FinishUpload" )
330
336
return err
331
337
}
332
338
0 commit comments