示例#1
0
文件: janus.go 项目: xenolog/janus
func init() {
	// Setup logger
	Log = logger.New()

	// Configure CLI flags and commands
	App = cli.NewApp()
	App.Name = "Janus"
	App.Version = Version
	App.EnableBashCompletion = true
	App.Usage = "BOT for Slack--IRC transparent proxying with support multi user"
	App.Flags = []cli.Flag{
		cli.BoolFlag{
			Name:  "debug",
			Usage: "Enable debug mode. Show more output",
		},
		cli.StringFlag{
			Name:  "config, c",
			Usage: "Specify config file (default: ./janus.jaml)",
		},
	}
	App.Commands = []cli.Command{{
		Name:   "runBot",
		Usage:  "Run bot",
		Action: runBot,
	}, {
		Name:   "control",
		Usage:  "Manipulate already started bots.",
		Action: runBot,
	}, {
		Name:   "test",
		Usage:  "Just run smaLog test.",
		Action: runTest,
	},
	}
	App.Before = func(c *cli.Context) error {
		Log.Info("Janus started.")
		if c.GlobalBool("debug") {
			Log.SetMinimalFacility(logger.LOG_D)
		} else {
			Log.SetMinimalFacility(logger.LOG_I)
		}
		return nil
	}
	App.CommandNotFound = func(c *cli.Context, cmd string) {
		Log.Printf("Wrong command '%s'", cmd)
		os.Exit(1)
	}
}
示例#2
0
文件: slack.go 项目: xenolog/janus
func init() {
	log = logger.New()
	mainSlack = new(Slack)
	mainSlack.init()
}