本文整理汇总了Golang中github.com/Sirupsen/logrus.Fatalln函数的典型用法代码示例。如果您正苦于以下问题:Golang Fatalln函数的具体用法?Golang Fatalln怎么用?Golang Fatalln使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Fatalln函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: runShell
func runShell(version string) {
if os.Getenv("GOBU") != "" {
log.Fatalln("Already in boostraped env!")
}
os.Setenv("GOBU", "1")
log.Println(">> You are now in a new GOBU shell. To exit, type 'exit'")
shell := os.Getenv("SHELL")
if runtime.GOOS == "windows" {
parentID := os.Getppid()
parentProcess, err := ps.FindProcess(parentID)
if err != nil {
log.Fatalln(err)
}
shell = parentProcess.Executable()
}
shellBinary := resolveBinary(shell)
run(version, shellBinary, []string{shellBinary})
log.Println("Exited gobu shell")
}
开发者ID:dz0ny,项目名称:gobu,代码行数:28,代码来源:main.go
示例2: destroy
func destroy(c *cli.Context) {
log.Infoln("Destroy")
additionalEnvs, err := config.CreateEnvItemsModelFromSlice(MachineParamsAdditionalEnvs.Get())
if err != nil {
log.Fatalf("Invalid Environment parameter: %s", err)
}
configModel, err := config.ReadMachineConfigFileFromDir(MachineWorkdir.Get(), additionalEnvs)
if err != nil {
log.Fatalln("Failed to read Config file: ", err)
}
isOK, err := pathutil.IsPathExists(path.Join(MachineWorkdir.Get(), "Vagrantfile"))
if err != nil {
log.Fatalln("Failed to check 'Vagrantfile' in the WorkDir: ", err)
}
if !isOK {
log.Fatalln("Vagrantfile not found in the WorkDir!")
}
log.Infof("configModel: %#v", configModel)
if err := doCleanup(configModel, "will-be-destroyed"); err != nil {
log.Fatalf("Failed to Cleanup: %s", err)
}
if err := doDestroy(configModel); err != nil {
log.Fatalf("Failed to Destroy: %s", err)
}
log.Infoln("=> Destroy DONE - OK")
}
开发者ID:bitrise-tools,项目名称:bitrise-machine,代码行数:33,代码来源:destroy.go
示例3: OnDisconnect
// OnDisconnect event. Terminates MumbleDJ process or retries connection if
// automatic connection retries are enabled.
func (dj *MumbleDJ) OnDisconnect(e *gumble.DisconnectEvent) {
dj.Queue.Reset()
if viper.GetBool("connection.retry_enabled") &&
(e.Type == gumble.DisconnectError || e.Type == gumble.DisconnectKicked) {
logrus.WithFields(logrus.Fields{
"interval_secs": fmt.Sprintf("%d", viper.GetInt("connection.retry_interval")),
"attempts": fmt.Sprintf("%d", viper.GetInt("connection.retry_attempts")),
}).Warnln("Disconnected from server. Retrying connection...")
success := false
for retries := 0; retries < viper.GetInt("connection.retry_attempts"); retries++ {
logrus.Infoln("Retrying connection...")
if client, err := gumble.DialWithDialer(new(net.Dialer), viper.GetString("connection.address")+":"+viper.GetString("connection.port"), dj.GumbleConfig, dj.TLSConfig); err == nil {
dj.Client = client
logrus.Infoln("Successfully reconnected to the server!")
success = true
break
}
time.Sleep(time.Duration(viper.GetInt("connection.retry_interval")) * time.Second)
}
if !success {
dj.KeepAlive <- true
logrus.Fatalln("Could not reconnect to server. Exiting...")
}
} else {
dj.KeepAlive <- true
logrus.Fatalln("Disconnected from server. No reconnect attempts will be made.")
}
}
开发者ID:matthieugrieger,项目名称:mumbledj,代码行数:31,代码来源:mumbledj.go
示例4: launchSyndicates
func (rs *RingSyndicates) launchSyndicates(k int) {
rs.Syndics[k].Lock()
defer rs.waitGroup.Done()
rs.waitGroup.Add(1)
l, err := net.Listen("tcp", fmt.Sprintf(":%d", rs.Syndics[k].config.Port))
if err != nil {
log.Fatalln(err)
return
}
var opts []grpc.ServerOption
creds, err := credentials.NewServerTLSFromFile(rs.Syndics[k].config.CertFile, rs.Syndics[k].config.KeyFile)
if err != nil {
log.Fatalln("Error load cert or key:", err)
}
opts = []grpc.ServerOption{grpc.Creds(creds)}
rs.Syndics[k].gs = grpc.NewServer(opts...)
if rs.Syndics[k].config.Master {
pb.RegisterSyndicateServer(rs.Syndics[k].gs, rs.Syndics[k].server)
log.Println("Master starting up on", rs.Syndics[k].config.Port)
rs.Syndics[k].gs.Serve(l)
} else {
//pb.RegisterRingDistServer(s, newRingDistServer())
//log.Printf("Starting ring slave up on %d...\n", cfg.Port)
//s.Serve(l)
log.Fatalln("Syndicate slaves not implemented yet")
}
rs.Syndics[k].Unlock()
}
开发者ID:getcfs,项目名称:cfs-binary-release,代码行数:29,代码来源:main.go
示例5: Execute
func (c *ArtifactsDownloaderCommand) Execute(context *cli.Context) {
formatter.SetRunnerFormatter()
if len(c.URL) == 0 || len(c.Token) == 0 {
logrus.Fatalln("Missing runner credentials")
}
if c.ID <= 0 {
logrus.Fatalln("Missing build ID")
}
// Create temporary file
file, err := ioutil.TempFile("", "artifacts")
if err != nil {
logrus.Fatalln(err)
}
file.Close()
defer os.Remove(file.Name())
// Download artifacts file
err = c.doRetry(func() (bool, error) {
return c.download(file.Name())
})
if err != nil {
logrus.Fatalln(err)
}
// Extract artifacts file
err = archives.ExtractZipFile(file.Name())
if err != nil {
logrus.Fatalln(err)
}
}
开发者ID:bssthu,项目名称:gitlab-ci-multi-runner,代码行数:32,代码来源:artifacts_downloader.go
示例6: main
func main() {
flag.Parse()
cpus := runtime.NumCPU()
runtime.GOMAXPROCS(cpus)
log.SetFormatter(&log.JSONFormatter{})
log.SetOutput(os.Stderr)
if *env == "production" {
log.SetLevel(log.WarnLevel)
} else {
log.SetLevel(log.DebugLevel)
}
log.Infoln("Starting server...")
// load config
d, err := ioutil.ReadFile(*configFile)
if err != nil {
log.Fatalln("[ERROR] read config.yml", err)
}
cfg, err := config.Load(bytes.NewReader(d), *env)
if err != nil {
log.Fatalln("[ERROR] config Load", err)
}
psAll := sphinx.NewSphinx(cfg.PSConfig, cpus)
ctx := context.Background()
ctx = sphinx.NewContext(ctx, psAll)
kami.Context = ctx
kami.Serve()
}
开发者ID:shunsukeaihara,项目名称:sphinx-httpserver,代码行数:32,代码来源:main.go
示例7: Chain
func (p *Client) Chain() []byte {
certs := make([][]byte, len(chainURLs))
var wg sync.WaitGroup
for i, url := range chainURLs {
wg.Add(1)
go func(i int, url string) {
defer wg.Done()
resp, err := http.Get(url)
if err != nil {
log.Fatalln(err)
return
}
defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatalln(err)
return
}
certs[i] = data
}(i, url)
}
wg.Wait()
result := make([]byte, 0, 1024*1024)
for _, data := range certs {
result = append(result, data...)
if result[len(result)-1] != 10 {
result = append(result, 10)
}
}
return result
}
开发者ID:denkhaus,项目名称:lecert,代码行数:31,代码来源:client.go
示例8: NewDBSession
//NewDBSession creates a new session to manage database data
func NewDBSession(database string) *r.Session {
conn, err := r.Connect(r.ConnectOpts{
Address: GetKeyValue("database", "address"),
Database: database,
MaxOpen: 40,
})
if err != nil {
log.Fatalln(err)
return nil
}
log.Infof("Connected to RethinkDB %s", GetKeyValue("database", "address"))
status, err := createDB(database, conn)
if err != nil {
log.Fatalln(err)
} else {
log.Info(status)
}
tables := []string{"Trip", "Place", "User"}
total, err := createTables(database, tables, conn)
if err != nil {
log.Fatalln(err)
} else {
log.Infof("%d new table(s) created", total)
}
return conn
}
开发者ID:yetis-br,项目名称:travelPlanning,代码行数:31,代码来源:db.go
示例9: waitForInterrupts
func waitForInterrupts(finished *bool, abortSignal chan os.Signal, doneSignal chan int) {
signals := make(chan os.Signal)
signal.Notify(signals, os.Interrupt, syscall.SIGTERM, syscall.SIGQUIT)
interrupt := <-signals
if finished != nil {
*finished = true
}
// request stop, but wait for force exit
for interrupt == syscall.SIGQUIT {
log.Warningln("Requested quit, waiting for builds to finish")
interrupt = <-signals
}
log.Warningln("Requested exit:", interrupt)
go func() {
for {
abortSignal <- interrupt
}
}()
select {
case newSignal := <-signals:
log.Fatalln("forced exit:", newSignal)
case <-time.After(common.ShutdownTimeout * time.Second):
log.Fatalln("shutdown timedout")
case <-doneSignal:
}
}
开发者ID:bssthu,项目名称:gitlab-ci-multi-runner,代码行数:31,代码来源:single.go
示例10: open
// open opens a new database connection with the specified
// driver and connection string and returns a store.
func open(driver, config string) *sql.DB {
db, err := sql.Open(driver, config)
if err != nil {
logrus.Errorln(err)
logrus.Fatalln("database connection failed")
}
if driver == "mysql" {
// per issue https://github.com/go-sql-driver/mysql/issues/257
db.SetMaxIdleConns(0)
}
setupMeddler(driver)
if err := pingDatabase(db); err != nil {
logrus.Errorln(err)
logrus.Fatalln("database ping attempts failed")
}
if err := setupDatabase(driver, db); err != nil {
logrus.Errorln(err)
logrus.Fatalln("migration failed")
}
cleanupDatabase(db)
return db
}
开发者ID:Ablu,项目名称:drone,代码行数:27,代码来源:store.go
示例11: Execute
func (c *UnregisterCommand) Execute(context *cli.Context) {
if !common.DeleteRunner(c.URL, c.Token) {
log.Fatalln("Failed to delete runner")
}
err := c.loadConfig()
if err != nil {
log.Warningln(err)
return
}
runners := []*common.RunnerConfig{}
for _, otherRunner := range c.config.Runners {
if otherRunner.RunnerCredentials == c.RunnerCredentials {
continue
}
runners = append(runners, otherRunner)
}
// check if anything changed
if len(c.config.Runners) == len(runners) {
return
}
c.config.Runners = runners
// save config file
err = c.saveConfig()
if err != nil {
log.Fatalln("Failed to update", c.ConfigFile, err)
}
log.Println("Updated", c.ConfigFile)
}
开发者ID:zhangxq5012,项目名称:gitlab-ci-multi-runner,代码行数:33,代码来源:unregister.go
示例12: Execute
func (c *ArchiveCommand) Execute(context *cli.Context) {
logrus.SetFormatter(
&logrus.TextFormatter{
ForceColors: true,
DisableTimestamp: false,
},
)
wd, err := os.Getwd()
if err != nil {
logrus.Fatalln("Failed to get current working directory:", err)
}
if c.Output == "" {
logrus.Fatalln("Missing archive file name!")
}
c.wd = wd
c.files = make(map[string]os.FileInfo)
c.processPaths()
c.processUntracked()
ai, err := os.Stat(c.Output)
if err != nil && !os.IsNotExist(err) {
logrus.Fatalln("Failed to verify archive:", c.Output, err)
}
if ai != nil {
if !c.isChanged(ai.ModTime()) {
logrus.Infoln("Archive is up to date!")
return
}
}
c.archive()
}
开发者ID:mikew,项目名称:gitlab-ci-multi-runner,代码行数:35,代码来源:archive.go
示例13: Execute
func (c *RunCommand) Execute(context *cli.Context) {
svcConfig := &service.Config{
Name: c.ServiceName,
DisplayName: c.ServiceName,
Description: defaultDescription,
Arguments: []string{"run"},
}
service, err := service_helpers.New(c, svcConfig)
if err != nil {
log.Fatalln(err)
}
if c.Syslog {
logger, err := service.SystemLogger(nil)
if err == nil {
log.AddHook(&ServiceLogHook{logger})
} else {
log.Errorln(err)
}
}
err = service.Run()
if err != nil {
log.Fatalln(err)
}
}
开发者ID:zhangxq5012,项目名称:gitlab-ci-multi-runner,代码行数:27,代码来源:multi.go
示例14: doSetup
func doSetup(c *cli.Context) {
PrintBitriseHeaderASCIIArt()
log.Infoln("[BITRISE_CLI] - Setup")
log.Infoln("Detected OS:", runtime.GOOS)
switch runtime.GOOS {
case "darwin":
if err := doSetupOnOSX(); err != nil {
log.Fatalln("Setup failed:", err)
}
case "linux":
if err := doSetupOnLinux(); err != nil {
log.Fatalln("Setup failed:", err)
}
default:
log.Fatalln("Sorry, unsupported platform :(")
}
// guide
fmt.Println()
log.Infoln("We're ready to rock!!")
fmt.Println()
log.Infoln("To start using bitrise:")
log.Infoln("* cd into your project's directory (if you're not there already)")
log.Infoln("* call: bitrise init")
log.Infoln("* follow the guide")
fmt.Println()
log.Infoln("That's all :)")
}
开发者ID:viktorbeneitest,项目名称:bitrise,代码行数:29,代码来源:doSetup.go
示例15: Execute
func (c *VerifyCommand) Execute(context *cli.Context) {
userModeWarning(true)
err := c.loadConfig()
if err != nil {
log.Fatalln(err)
return
}
// verify if runner exist
runners := []*common.RunnerConfig{}
for _, runner := range c.config.Runners {
if c.network.VerifyRunner(runner.RunnerCredentials) {
runners = append(runners, runner)
}
}
if !c.DeleteNonExisting {
return
}
// check if anything changed
if len(c.config.Runners) == len(runners) {
return
}
c.config.Runners = runners
// save config file
err = c.saveConfig()
if err != nil {
log.Fatalln("Failed to update", c.ConfigFile, err)
}
log.Println("Updated", c.ConfigFile)
}
开发者ID:bssthu,项目名称:gitlab-ci-multi-runner,代码行数:35,代码来源:verify.go
示例16: Execute
func (mr *RunCommand) Execute(context *cli.Context) {
svcConfig := &service.Config{
Name: mr.ServiceName,
DisplayName: mr.ServiceName,
Description: defaultDescription,
Arguments: []string{"run"},
Option: service.KeyValue{
"RunWait": mr.runWait,
},
}
service, err := service_helpers.New(mr, svcConfig)
if err != nil {
log.Fatalln(err)
}
if mr.Syslog {
log.SetFormatter(new(log.TextFormatter))
logger, err := service.SystemLogger(nil)
if err == nil {
log.AddHook(&ServiceLogHook{logger, log.InfoLevel})
} else {
log.Errorln(err)
}
}
log.AddHook(&mr.sentryLogHook)
err = service.Run()
if err != nil {
log.Fatalln(err)
}
}
开发者ID:bssthu,项目名称:gitlab-ci-multi-runner,代码行数:33,代码来源:multi.go
示例17: runVerify
func runVerify(c *cli.Context) {
config := common.NewConfig()
err := config.LoadConfig(c.String("config"))
if err != nil {
log.Fatalln(err)
return
}
// verify if runner exist
runners := []*common.RunnerConfig{}
for _, runner := range config.Runners {
if common.VerifyRunner(runner.URL, runner.Token) {
runners = append(runners, runner)
}
}
if !c.Bool("delete") {
return
}
// check if anything changed
if len(config.Runners) == len(runners) {
return
}
config.Runners = runners
// save config file
err = config.SaveConfig(c.String("config"))
if err != nil {
log.Fatalln("Failed to update", c.String("config"), err)
}
log.Println("Updated", c.String("config"))
}
开发者ID:AdrianoJS,项目名称:gitlab-ci-multi-runner,代码行数:34,代码来源:verify.go
示例18: listen
func (s *serv) listen() {
switch s.proto {
case tcp:
ln, err := net.Listen("tcp", s.addr)
if err != nil {
logrus.Fatalln("net.Listen error", s.addr, err)
}
s.setalive()
if logrus.GetLevel() >= logrus.DebugLevel {
logrus.Debugln("listen to", s.addr)
}
go acceptTCP(ln, s.tcphandler)
case udp:
udpaddr, err := net.ResolveUDPAddr("udp", s.addr)
if err != nil {
logrus.Fatalln("net.ResolveUDPAddr error", s.addr, err)
}
udpconn, err := net.ListenUDP("udp", udpaddr)
if err != nil {
logrus.Fatalln("net.ListenUDP error", udpaddr, err)
}
s.setalive()
go func() {
for {
s.udphandler(udpconn)
}
}()
}
}
开发者ID:tomasen,项目名称:trafcacc,代码行数:33,代码来源:server.go
示例19: gameChangeState
func gameChangeState(ctx *cli.Context) error {
connect(true, false)
defer closeConn()
if len(ctx.Args()) != 3 {
logrus.Fatalln("you must enter exactly three arguments, ex: 'otsimoctl game change-state sample-game 0.1.2 validated'")
}
uniqueName := ctx.Args().Get(0)
version := ctx.Args().Get(1)
state := ctx.Args().Get(2)
ns, err := stringToState(state)
if err != nil {
logrus.Fatalln("invalid state name:", state)
}
game, err := registryClient.Get(context.Background(), &apipb.GetGameRequest{UniqueName: uniqueName})
if err != nil {
logrus.Fatalf("failed to get game by name. \nname='%s'\nerror=%v", uniqueName, err)
}
resp, err := registryClient.ChangeReleaseState(context.Background(), &apipb.ValidateRequest{
GameId: game.Id,
GameVersion: version,
NewState: ns,
})
if err != nil {
logrus.Fatalf("failed to change state.\nerror=%+v", err)
}
fmt.Printf("finished, result=%+v\n", resp.Message)
return nil
}
开发者ID:otsimo,项目名称:otsimoctl,代码行数:29,代码来源:game_state.go
示例20: dockerClient
func dockerClient(c *cli.Context) *docker.Client {
if c.String("docker") == "" {
log.Fatalln("daemon is required!")
}
var client *docker.Client
var err error
if c.Bool("tls") {
cert := c.String("cert")
if cert == "" {
log.Fatalln("cert directory is required!")
}
cer := fmt.Sprintf("%s/cert.pem", cert)
key := fmt.Sprintf("%s/key.pem", cert)
ca := fmt.Sprintf("%s/ca.pem", cert)
if client, err = docker.NewTLSClient(c.String("docker"), cer, key, ca); err != nil {
log.Fatalln(err.Error())
}
} else {
if client, err = docker.NewClient(c.String("docker")); err != nil {
log.Fatalln(err.Error())
}
}
return client
}
开发者ID:jmptrader,项目名称:beacon,代码行数:25,代码来源:utils.go
注:本文中的github.com/Sirupsen/logrus.Fatalln函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论