File: log.go

package info (click to toggle)
golang-github-anacrolix-fuse 0.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,000 kB
  • sloc: makefile: 5; sh: 3
file content (39 lines) | stat: -rw-r--r-- 582 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package loog

import (
	"fmt"
	"io"
	"os"

	"github.com/anacrolix/fuse"
)

var sink io.WriteCloser

func SetSink(file string) {
	f, err := os.Create(file)
	if err != nil {
		panic(err)
	}
	sink = f
}

func LogAttr(p string, a *fuse.Attr, err error) {
	fmt.Fprintf(sink, "Attr valid=%s Inode=%x size=%d blocks=%d mode=%o nlink=%d uid=%d gid=%d rdev=%x flags=%o blocksize=%d error=%v path=%s\n",
		a.Valid,
		a.Inode,
		a.Size,
		a.Blocks,
		//  a.Atime
		//  a.Mtime
		//  a.Ctime
		//  a.Crtime
		a.Mode,
		a.Nlink,
		a.Uid,
		a.Gid,
		a.Rdev,
		a.Flags,
		a.BlockSize,
		err, p)
}