本文整理汇总了Golang中github.com/coreos/rkt/pkg/log.NewLogSet函数的典型用法代码示例。如果您正苦于以下问题:Golang NewLogSet函数的具体用法?Golang NewLogSet怎么用?Golang NewLogSet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewLogSet函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: init
func init() {
flag.BoolVar(&debug, "debug", false, "Run in debug mode")
flag.StringVar(&podPid, "pid", "", "podPID")
flag.StringVar(&appName, "appname", "", "application to use")
log, diag, _ = rktlog.NewLogSet("kvm", false)
}
开发者ID:intelsdi-x,项目名称:rkt,代码行数:7,代码来源:enter_kvm.go
示例2: main
func main() {
flag.Parse()
log, diag, _ = rktlog.NewLogSet("stage1 gc", debug)
if !debug {
diag.SetOutput(ioutil.Discard)
}
podID, err := types.NewUUID(flag.Arg(0))
if err != nil {
log.Fatal("UUID is missing or malformed")
}
diag.Printf("Removing journal link.")
if err := removeJournalLink(podID); err != nil {
log.PrintE("error removing journal link", err)
}
diag.Printf("Cleaning up cgroups.")
if err := cleanupV1Cgroups(); err != nil {
log.PrintE("error cleaning up cgroups", err)
}
diag.Printf("Tearing down networks.")
if err := gcNetworking(podID); err != nil {
log.FatalE("", err)
}
}
开发者ID:intelsdi-x,项目名称:rkt,代码行数:28,代码来源:gc.go
示例3: init
func init() {
flag.BoolVar(&debug, "debug", false, "Run in debug mode")
flag.StringVar(&podPid, "pid", "", "Pod PID")
flag.StringVar(&appName, "appname", "", "Application (Ignored in rkt fly)")
log, diag, _ = rktlog.NewLogSet("fly-enter", false)
}
开发者ID:intelsdi-x,项目名称:rkt,代码行数:7,代码来源:main.go
示例4: main
func main() {
flag.Parse()
stage1initcommon.InitDebug(debug)
log, diag, _ = rktlog.NewLogSet("app-start", debug)
if !debug {
diag.SetOutput(ioutil.Discard)
}
appName, err := types.NewACName(flagApp)
if err != nil {
log.FatalE("invalid app name", err)
}
enterCmd := stage1common.PrepareEnterCmd(false)
args := enterCmd
args = append(args, "/usr/bin/systemctl")
args = append(args, "start")
args = append(args, appName.String())
cmd := exec.Cmd{
Path: args[0],
Args: args,
}
if out, err := cmd.CombinedOutput(); err != nil {
log.Fatalf("%q failed to start:\n%s", appName, out)
}
os.Exit(0)
}
开发者ID:intelsdi-x,项目名称:rkt,代码行数:33,代码来源:app-start.go
示例5: ensureLogger
func ensureLogger(debug bool) {
if log == nil || diag == nil || stdout == nil {
log, diag, stdout = rktlog.NewLogSet("image", debug)
}
if !debug {
diag.SetOutput(ioutil.Discard)
}
}
开发者ID:intelsdi-x,项目名称:rkt,代码行数:8,代码来源:common.go
示例6: main
func main() {
flag.Parse()
log, diag, _ = rktlog.NewLogSet("run", debug)
if !debug {
diag.SetOutput(ioutil.Discard)
}
// move code into stage1() helper so defered fns get run
os.Exit(stage1())
}
开发者ID:nak3,项目名称:rkt,代码行数:11,代码来源:main.go
示例7: init
func init() {
flag.BoolVar(&debug, "debug", false, "Run in debug mode")
flag.StringVar(&podPid, "pid", "", "podPID")
flag.StringVar(&appName, "appname", "", "application to use")
log, diag, _ = rktlog.NewLogSet("kvm", false)
var err error
if sshPath, err = exec.LookPath("ssh"); err != nil {
log.FatalE("cannot find 'ssh' binary in PATH", err)
}
}
开发者ID:coderhaoxin,项目名称:rkt,代码行数:12,代码来源:enter_kvm.go
示例8: main
func main() {
rp := parseFlags()
stage1initcommon.InitDebug(debug)
log, diag, _ = rktlog.NewLogSet("stage1", debug)
if !debug {
diag.SetOutput(ioutil.Discard)
}
// move code into stage1() helper so deferred fns get run
os.Exit(stage1(rp))
}
开发者ID:intelsdi-x,项目名称:rkt,代码行数:12,代码来源:init.go
示例9: main
// TODO use named flags instead of positional
func main() {
flag.Parse()
stage1initcommon.InitDebug(debug)
log, diag, _ = rktlog.NewLogSet("stage1", debug)
if !debug {
diag.SetOutput(ioutil.Discard)
}
appName, err := types.NewACName(flag.Arg(1))
if err != nil {
log.PrintE("invalid app name", err)
os.Exit(254)
}
enterEP := flag.Arg(2)
args := []string{enterEP}
args = append(args, fmt.Sprintf("--pid=%s", flag.Arg(3)))
args = append(args, "/usr/bin/systemctl")
args = append(args, "stop")
args = append(args, appName.String())
cmd := exec.Cmd{
Path: args[0],
Args: args,
}
if err := cmd.Run(); err != nil {
log.PrintE(fmt.Sprintf("error stopping app %q", appName.String()), err)
os.Exit(254)
}
os.Exit(0)
}
开发者ID:nhlfr,项目名称:rkt,代码行数:38,代码来源:app-stop.go
示例10: main
// TODO use named flags instead of positional
func main() {
flag.Parse()
stage1initcommon.InitDebug(debug)
log, diag, _ = rktlog.NewLogSet("stage1", debug)
if !debug {
diag.SetOutput(ioutil.Discard)
}
uuid, err := types.NewUUID(flag.Arg(0))
if err != nil {
log.PrintE("UUID is missing or malformed", err)
os.Exit(254)
}
appName, err := types.NewACName(flag.Arg(1))
if err != nil {
log.PrintE("invalid app name", err)
os.Exit(254)
}
enterEP := flag.Arg(2)
root := "."
p, err := stage1types.LoadPod(root, uuid)
if err != nil {
log.PrintE("failed to load pod", err)
os.Exit(254)
}
insecureOptions := stage1initcommon.Stage1InsecureOptions{
DisablePaths: disablePaths,
DisableCapabilities: disableCapabilities,
DisableSeccomp: disableSeccomp,
}
ra := p.Manifest.Apps.Get(*appName)
if ra == nil {
log.Printf("failed to get app")
os.Exit(254)
}
if ra.App.WorkingDirectory == "" {
ra.App.WorkingDirectory = "/"
}
binPath, err := stage1initcommon.FindBinPath(p, ra)
if err != nil {
log.PrintE("failed to find bin path", err)
os.Exit(254)
}
w := stage1initcommon.NewUnitWriter(p)
w.AppUnit(ra, binPath, privateUsers, insecureOptions,
unit.NewUnitOption("Unit", "Before", "halt.target"),
unit.NewUnitOption("Unit", "Conflicts", "halt.target"),
unit.NewUnitOption("Service", "StandardOutput", "journal+console"),
unit.NewUnitOption("Service", "StandardError", "journal+console"),
)
w.AppReaperUnit(ra.Name, binPath)
if err := w.Error(); err != nil {
log.PrintE("error generating app units", err)
os.Exit(254)
}
args := []string{enterEP}
args = append(args, fmt.Sprintf("--pid=%s", flag.Arg(3)))
args = append(args, "/usr/bin/systemctl")
args = append(args, "daemon-reload")
cmd := exec.Cmd{
Path: args[0],
Args: args,
}
if err := cmd.Run(); err != nil {
log.PrintE("error executing daemon-reload", err)
os.Exit(254)
}
args = []string{enterEP}
args = append(args, fmt.Sprintf("--pid=%s", flag.Arg(3)))
args = append(args, "/usr/bin/systemctl")
args = append(args, "start")
args = append(args, appName.String())
cmd = exec.Cmd{
Path: args[0],
Args: args,
}
if err := cmd.Run(); err != nil {
log.PrintE(fmt.Sprintf("error starting app %q", appName.String()), err)
//.........这里部分代码省略.........
开发者ID:nhlfr,项目名称:rkt,代码行数:101,代码来源:app-start.go
示例11: main
// TODO use named flags instead of positional
func main() {
flag.Parse()
stage1initcommon.InitDebug(debug)
log, diag, _ = rktlog.NewLogSet("stage1", debug)
if !debug {
diag.SetOutput(ioutil.Discard)
}
appName, err := types.NewACName(flag.Arg(1))
if err != nil {
log.PrintE("invalid app name", err)
os.Exit(254)
}
enterEP := flag.Arg(2)
args := []string{enterEP}
args = append(args, fmt.Sprintf("--pid=%s", flag.Arg(3)))
args = append(args, "/usr/bin/systemctl")
args = append(args, "is-active")
args = append(args, appName.String())
cmd := exec.Cmd{
Path: args[0],
Args: args,
}
// rely only on the output, since it returns non-zero for inactive units
out, _ := cmd.Output()
if string(out) != "inactive\n" {
log.Printf("app %q is still running", appName.String())
os.Exit(254)
}
s1rootfs := common.Stage1RootfsPath(".")
serviceDir := filepath.Join(s1rootfs, "usr", "lib", "systemd", "system")
appServicePaths := []string{
filepath.Join(serviceDir, appName.String()+".service"),
filepath.Join(serviceDir, "reaper-"+appName.String()+".service"),
}
for _, p := range appServicePaths {
if err := os.Remove(p); err != nil && !os.IsNotExist(err) {
log.PrintE("error removing app service file", err)
os.Exit(254)
}
}
args = []string{enterEP}
args = append(args, fmt.Sprintf("--pid=%s", flag.Arg(3)))
args = append(args, "/usr/bin/systemctl")
args = append(args, "daemon-reload")
cmd = exec.Cmd{
Path: args[0],
Args: args,
}
if err := cmd.Run(); err != nil {
log.PrintE(`error executing "systemctl daemon-reload"`, err)
os.Exit(254)
}
// TODO unmount all the volumes
os.Exit(0)
}
开发者ID:nhlfr,项目名称:rkt,代码行数:71,代码来源:app-rm.go
示例12: main
func main() {
flag.Parse()
stage1initcommon.InitDebug(debug)
log, diag, _ = rktlog.NewLogSet("app-add", debug)
if !debug {
diag.SetOutput(ioutil.Discard)
}
uuid, err := types.NewUUID(flagUUID)
if err != nil {
log.FatalE("UUID is missing or malformed", err)
}
appName, err := types.NewACName(flagApp)
if err != nil {
log.FatalE("invalid app name", err)
}
root := "."
p, err := stage1types.LoadPod(root, uuid)
if err != nil {
log.FatalE("failed to load pod", err)
}
flavor, _, err := stage1initcommon.GetFlavor(p)
if err != nil {
log.FatalE("failed to get stage1 flavor", err)
}
insecureOptions := stage1initcommon.Stage1InsecureOptions{
DisablePaths: disablePaths,
DisableCapabilities: disableCapabilities,
DisableSeccomp: disableSeccomp,
}
ra := p.Manifest.Apps.Get(*appName)
if ra == nil {
log.Fatalf("failed to find app %q", *appName)
}
binPath, err := stage1initcommon.FindBinPath(p, ra)
if err != nil {
log.FatalE("failed to find bin path", err)
}
if ra.App.WorkingDirectory == "" {
ra.App.WorkingDirectory = "/"
}
enterCmd := stage1common.PrepareEnterCmd(false)
stage1initcommon.AppAddMounts(p, ra, enterCmd)
// when using host cgroups, make the subgroup writable by pod systemd
if flavor != "kvm" {
err = prepareAppCgroups(p, ra, enterCmd)
if err != nil {
log.FatalE("error preparing cgroups", err)
}
}
// write service files
w := stage1initcommon.NewUnitWriter(p)
w.AppUnit(ra, binPath, privateUsers, insecureOptions,
unit.NewUnitOption("Unit", "Before", "halt.target"),
unit.NewUnitOption("Unit", "Conflicts", "halt.target"),
unit.NewUnitOption("Service", "StandardOutput", "journal+console"),
unit.NewUnitOption("Service", "StandardError", "journal+console"),
)
w.AppReaperUnit(ra.Name, binPath)
if err := w.Error(); err != nil {
log.FatalE("error generating app units", err)
}
// stage2 environment is ready at this point, but systemd does not know
// about the new application yet
args := enterCmd
args = append(args, "/usr/bin/systemctl")
args = append(args, "daemon-reload")
cmd := exec.Cmd{
Path: args[0],
Args: args,
}
if out, err := cmd.CombinedOutput(); err != nil {
log.Fatalf("%q failed at daemon-reload:\n%s", appName, out)
}
os.Exit(0)
}
开发者ID:joshix,项目名称:rkt,代码行数:92,代码来源:app-add.go
示例13: init
func init() {
log, diag, _ = rktlog.NewLogSet("stage1", false)
}
开发者ID:sinfomicien,项目名称:rkt,代码行数:3,代码来源:log.go
注:本文中的github.com/coreos/rkt/pkg/log.NewLogSet函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论