{"action":"created","comment":{"url":"https://api.github.com/repos/minio/minio/pulls/comments/53744373","id":53744373,"diff_hunk":"@@ -34,130 +36,215 @@ var configLoggerCmd = cli.Command{\n USAGE:\n    minio config {{.Name}} OPERATION [ARGS...]\n \n-   OPERATION = add | list | remove\n+OPERATION:\n+   enable  LOGGER mongo   [ADDRESS]  [LEVEL]\n+   enable  LOGGER file    [FILENAME] [LEVEL]\n+   enable  LOGGER syslog  [ADDRESS]  [LEVEL]\n+   enable  LOGGER console [LEVEL]\n+   disable LOGGER [TYPE]\n+   list\n+\n+   LEVEL = error|access|warning|info|debug\n \n EXAMPLES:\n    1. Configure new mongo logger.\n-      $ minio config {{.Name}} add mongo localhost:28710 mydb mylogger\n+      $ minio config {{.Name}} enable mongo localhost:27017 access\n \n-   2. Configure new syslog logger. NOTE: syslog logger is not supported on windows.\n-      $ minio config {{.Name}} add syslog localhost:554 udp\n+   2. Configure new file logger. \"/var/log\" should be writable by user.\n+      $ minio config {{.Name}} enable file /var/log/minio.log error\n \n-   3. Configure new file logger. \"/var/log\" should be writable by user.\n-      $ minio config {{.Name}} add file /var/log/minio.log\n+   3. Configure new syslog remote logger. NOTE: syslog is not supported on Windows.\n+      $ minio config {{.Name}} enable syslog localhost:5514 debug\n \n-   4. List currently configured logger.\n+   3. List of all currently configured loggers.\n       $ minio config {{.Name}} list\n \n-   5. Remove/Reset a configured logger.\n-      $ minio config {{.Name}} remove mongo\n+   4. Remove/Reset a configured logger.\n+      $ minio config {{.Name}} disable mongo\n `,\n }\n \n-// Inherit at one place\n-type config struct {\n-\t*configV2\n+// validate log level, returns true if supported false otherwise.\n+func isValidLogLevel(logLevel string) bool {\n+\tswitch logLevel {\n+\tcase \"error\", \"access\", \"warning\", \"info\", \"debug\":\n+\t\treturn true\n+\t}\n+\treturn false\n }\n \n-func mainConfigLogger(ctx *cli.Context) {\n-\tif !ctx.Args().Present() || ctx.Args().First() == \"help\" {\n-\t\tcli.ShowCommandHelpAndExit(ctx, \"logger\", 1) // last argument is exit code\n+// parse Console logger type.\n+func parseConsole(logLevel string) (consoleLogger, *probe.Error) {\n+\t// Validate input log level.\n+\tif !isValidLogLevel(logLevel) {\n+\t\treturn consoleLogger{}, probe.NewError(errors.New(\"Unrecognized log level \" + logLevel))\n \t}\n-\tconf, err := loadConfigV2()\n-\tfatalIf(err.Trace(), \"Unable to load config\", nil)\n+\t// Initialize console logger.\n+\tclogger := consoleLogger{","path":"config-logger-main.go","position":74,"original_position":74,"commit_id":"2cd4d870466218a60b6d3e8fc0e361b09f278b5c","original_commit_id":"2cd4d870466218a60b6d3e8fc0e361b09f278b5c","user":{"login":"abperiasamy","id":624261,"avatar_url":"https://avatars.githubusercontent.com/u/624261?v=3","gravatar_id":"","url":"https://api.github.com/users/abperiasamy","html_url":"https://github.com/abperiasamy","followers_url":"https://api.github.com/users/abperiasamy/followers","following_url":"https://api.github.com/users/abperiasamy/following{/other_user}","gists_url":"https://api.github.com/users/abperiasamy/gists{/gist_id}","starred_url":"https://api.github.com/users/abperiasamy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abperiasamy/subscriptions","organizations_url":"https://api.github.com/users/abperiasamy/orgs","repos_url":"https://api.github.com/users/abperiasamy/repos","events_url":"https://api.github.com/users/abperiasamy/events{/privacy}","received_events_url":"https://api.github.com/users/abperiasamy/received_events","type":"User","site_admin":false},"body":"conLogger","created_at":"2016-02-23T07:29:34Z","updated_at":"2016-02-23T07:29:34Z","html_url":"https://github.com/minio/minio/pull/1123#discussion_r53744373","pull_request_url":"https://api.github.com/repos/minio/minio/pulls/1123","_links":{"self":{"href":"https://api.github.com/repos/minio/minio/pulls/comments/53744373"},"html":{"href":"https://github.com/minio/minio/pull/1123#discussion_r53744373"},"pull_request":{"href":"https://api.github.com/repos/minio/minio/pulls/1123"}}},"pull_request":{"url":"https://api.github.com/repos/minio/minio/pulls/1123","id":59263428,"html_url":"https://github.com/minio/minio/pull/1123","diff_url":"https://github.com/minio/minio/pull/1123.diff","patch_url":"https://github.com/minio/minio/pull/1123.patch","issue_url":"https://api.github.com/repos/minio/minio/issues/1123","number":1123,"state":"open","locked":false,"title":"config/main: Re-write config files - add to new config v3","user":{"login":"harshavardhana","id":622699,"avatar_url":"https://avatars.githubusercontent.com/u/622699?v=3","gravatar_id":"","url":"https://api.github.com/users/harshavardhana","html_url":"https://github.com/harshavardhana","followers_url":"https://api.github.com/users/harshavardhana/followers","following_url":"https://api.github.com/users/harshavardhana/following{/other_user}","gists_url":"https://api.github.com/users/harshavardhana/gists{/gist_id}","starred_url":"https://api.github.com/users/harshavardhana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harshavardhana/subscriptions","organizations_url":"https://api.github.com/users/harshavardhana/orgs","repos_url":"https://api.github.com/users/harshavardhana/repos","events_url":"https://api.github.com/users/harshavardhana/events{/privacy}","received_events_url":"https://api.github.com/users/harshavardhana/received_events","type":"User","site_admin":false},"body":"New config format.\r\n\r\n```\r\n{\r\n\t\"version\": \"3\",\r\n\t\"address\": \":9000\",\r\n\t\"tls\": {\r\n\t\t\"certFile\": \"\",\r\n\t\t\"keyFile\": \"\"\r\n\t},\r\n\t\"credential\": {\r\n\t\t\"accessKey\": \"WLGDGYAQYIGI833EV05A\",\r\n\t\t\"secretKey\": \"BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF\"\r\n\t},\r\n\t\"region\": \"us-east-1\",\r\n\t\"logger\": {\r\n\t\t\"mongo\": {\r\n\t\t\t\"enable\": false,\r\n\t\t\t\"address\": \"\",\r\n\t\t\t\"level\": \"access\"\r\n\t\t},\r\n\t\t\"file\": {\r\n\t\t\t\"enable\": false,\r\n\t\t\t\"fileName\": \"\",\r\n\t\t\t\"level\": \"error\"\r\n\t\t},\r\n\t\t\"syslog\": {\r\n\t\t\t\"enable\": false,\r\n\t\t\t\"address\": \"\",\r\n\t\t\t\"level\": \"debug\"\r\n\t\t},\r\n\t\t\"console\": {\r\n\t\t\t\"enable\": true,\r\n\t\t\t\"level\": \"fatal\"\r\n\t\t}\r\n\t}\r\n}\r\n```","created_at":"2016-02-13T09:32:07Z","updated_at":"2016-02-23T07:29:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"359c82f1bd3295e86a1d72520aed5b07881b48f0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/minio/minio/pulls/1123/commits","review_comments_url":"https://api.github.com/repos/minio/minio/pulls/1123/comments","review_comment_url":"https://api.github.com/repos/minio/minio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/minio/minio/issues/1123/comments","statuses_url":"https://api.github.com/repos/minio/minio/statuses/2cd4d870466218a60b6d3e8fc0e361b09f278b5c","head":{"label":"harshavardhana:rewrite-v1","ref":"rewrite-v1","sha":"2cd4d870466218a60b6d3e8fc0e361b09f278b5c","user":{"login":"harshavardhana","id":622699,"avatar_url":"https://avatars.githubusercontent.com/u/622699?v=3","gravatar_id":"","url":"https://api.github.com/users/harshavardhana","html_url":"https://github.com/harshavardhana","followers_url":"https://api.github.com/users/harshavardhana/followers","following_url":"https://api.github.com/users/harshavardhana/following{/other_user}","gists_url":"https://api.github.com/users/harshavardhana/gists{/gist_id}","starred_url":"https://api.github.com/users/harshavardhana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harshavardhana/subscriptions","organizations_url":"https://api.github.com/users/harshavardhana/orgs","repos_url":"https://api.github.com/users/harshavardhana/repos","events_url":"https://api.github.com/users/harshavardhana/events{/privacy}","received_events_url":"https://api.github.com/users/harshavardhana/received_events","type":"User","site_admin":false},"repo":{"id":29261868,"name":"minio","full_name":"harshavardhana/minio","owner":{"login":"harshavardhana","id":622699,"avatar_url":"https://avatars.githubusercontent.com/u/622699?v=3","gravatar_id":"","url":"https://api.github.com/users/harshavardhana","html_url":"https://github.com/harshavardhana","followers_url":"https://api.github.com/users/harshavardhana/followers","following_url":"https://api.github.com/users/harshavardhana/following{/other_user}","gists_url":"https://api.github.com/users/harshavardhana/gists{/gist_id}","starred_url":"https://api.github.com/users/harshavardhana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harshavardhana/subscriptions","organizations_url":"https://api.github.com/users/harshavardhana/orgs","repos_url":"https://api.github.com/users/harshavardhana/repos","events_url":"https://api.github.com/users/harshavardhana/events{/privacy}","received_events_url":"https://api.github.com/users/harshavardhana/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/harshavardhana/minio","description":"Minio is open source Object Storage inspired from Amazon S3 API and Haystack Object Format","fork":true,"url":"https://api.github.com/repos/harshavardhana/minio","forks_url":"https://api.github.com/repos/harshavardhana/minio/forks","keys_url":"https://api.github.com/repos/harshavardhana/minio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/harshavardhana/minio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/harshavardhana/minio/teams","hooks_url":"https://api.github.com/repos/harshavardhana/minio/hooks","issue_events_url":"https://api.github.com/repos/harshavardhana/minio/issues/events{/number}","events_url":"https://api.github.com/repos/harshavardhana/minio/events","assignees_url":"https://api.github.com/repos/harshavardhana/minio/assignees{/user}","branches_url":"https://api.github.com/repos/harshavardhana/minio/branches{/branch}","tags_url":"https://api.github.com/repos/harshavardhana/minio/tags","blobs_url":"https://api.github.com/repos/harshavardhana/minio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/harshavardhana/minio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/harshavardhana/minio/git/refs{/sha}","trees_url":"https://api.github.com/repos/harshavardhana/minio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/harshavardhana/minio/statuses/{sha}","languages_url":"https://api.github.com/repos/harshavardhana/minio/languages","stargazers_url":"https://api.github.com/repos/harshavardhana/minio/stargazers","contributors_url":"https://api.github.com/repos/harshavardhana/minio/contributors","subscribers_url":"https://api.github.com/repos/harshavardhana/minio/subscribers","subscription_url":"https://api.github.com/repos/harshavardhana/minio/subscription","commits_url":"https://api.github.com/repos/harshavardhana/minio/commits{/sha}","git_commits_url":"https://api.github.com/repos/harshavardhana/minio/git/commits{/sha}","comments_url":"https://api.github.com/repos/harshavardhana/minio/comments{/number}","issue_comment_url":"https://api.github.com/repos/harshavardhana/minio/issues/comments{/number}","contents_url":"https://api.github.com/repos/harshavardhana/minio/contents/{+path}","compare_url":"https://api.github.com/repos/harshavardhana/minio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/harshavardhana/minio/merges","archive_url":"https://api.github.com/repos/harshavardhana/minio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/harshavardhana/minio/downloads","issues_url":"https://api.github.com/repos/harshavardhana/minio/issues{/number}","pulls_url":"https://api.github.com/repos/harshavardhana/minio/pulls{/number}","milestones_url":"https://api.github.com/repos/harshavardhana/minio/milestones{/number}","notifications_url":"https://api.github.com/repos/harshavardhana/minio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/harshavardhana/minio/labels{/name}","releases_url":"https://api.github.com/repos/harshavardhana/minio/releases{/id}","deployments_url":"https://api.github.com/repos/harshavardhana/minio/deployments","created_at":"2015-01-14T19:32:24Z","updated_at":"2015-11-03T05:50:43Z","pushed_at":"2016-02-23T07:09:50Z","git_url":"git://github.com/harshavardhana/minio.git","ssh_url":"git@github.com:harshavardhana/minio.git","clone_url":"https://github.com/harshavardhana/minio.git","svn_url":"https://github.com/harshavardhana/minio","homepage":"http://minio.io","size":9108,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"pr_out_minio_dl_minio_io_changes_do_not_merge_until_webcli"}},"base":{"label":"minio:master","ref":"master","sha":"b31dac916249d30fec9db6cfe2f1220d2aea4948","user":{"login":"minio","id":695951,"avatar_url":"https://avatars.githubusercontent.com/u/695951?v=3","gravatar_id":"","url":"https://api.github.com/users/minio","html_url":"https://github.com/minio","followers_url":"https://api.github.com/users/minio/followers","following_url":"https://api.github.com/users/minio/following{/other_user}","gists_url":"https://api.github.com/users/minio/gists{/gist_id}","starred_url":"https://api.github.com/users/minio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minio/subscriptions","organizations_url":"https://api.github.com/users/minio/orgs","repos_url":"https://api.github.com/users/minio/repos","events_url":"https://api.github.com/users/minio/events{/privacy}","received_events_url":"https://api.github.com/users/minio/received_events","type":"Organization","site_admin":false},"repo":{"id":29261473,"name":"minio","full_name":"minio/minio","owner":{"login":"minio","id":695951,"avatar_url":"https://avatars.githubusercontent.com/u/695951?v=3","gravatar_id":"","url":"https://api.github.com/users/minio","html_url":"https://github.com/minio","followers_url":"https://api.github.com/users/minio/followers","following_url":"https://api.github.com/users/minio/following{/other_user}","gists_url":"https://api.github.com/users/minio/gists{/gist_id}","starred_url":"https://api.github.com/users/minio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minio/subscriptions","organizations_url":"https://api.github.com/users/minio/orgs","repos_url":"https://api.github.com/users/minio/repos","events_url":"https://api.github.com/users/minio/events{/privacy}","received_events_url":"https://api.github.com/users/minio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/minio/minio","description":"Minio is a distributed object storage server written in Golang.","fork":false,"url":"https://api.github.com/repos/minio/minio","forks_url":"https://api.github.com/repos/minio/minio/forks","keys_url":"https://api.github.com/repos/minio/minio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/minio/minio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/minio/minio/teams","hooks_url":"https://api.github.com/repos/minio/minio/hooks","issue_events_url":"https://api.github.com/repos/minio/minio/issues/events{/number}","events_url":"https://api.github.com/repos/minio/minio/events","assignees_url":"https://api.github.com/repos/minio/minio/assignees{/user}","branches_url":"https://api.github.com/repos/minio/minio/branches{/branch}","tags_url":"https://api.github.com/repos/minio/minio/tags","blobs_url":"https://api.github.com/repos/minio/minio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/minio/minio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/minio/minio/git/refs{/sha}","trees_url":"https://api.github.com/repos/minio/minio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/minio/minio/statuses/{sha}","languages_url":"https://api.github.com/repos/minio/minio/languages","stargazers_url":"https://api.github.com/repos/minio/minio/stargazers","contributors_url":"https://api.github.com/repos/minio/minio/contributors","subscribers_url":"https://api.github.com/repos/minio/minio/subscribers","subscription_url":"https://api.github.com/repos/minio/minio/subscription","commits_url":"https://api.github.com/repos/minio/minio/commits{/sha}","git_commits_url":"https://api.github.com/repos/minio/minio/git/commits{/sha}","comments_url":"https://api.github.com/repos/minio/minio/comments{/number}","issue_comment_url":"https://api.github.com/repos/minio/minio/issues/comments{/number}","contents_url":"https://api.github.com/repos/minio/minio/contents/{+path}","compare_url":"https://api.github.com/repos/minio/minio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/minio/minio/merges","archive_url":"https://api.github.com/repos/minio/minio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/minio/minio/downloads","issues_url":"https://api.github.com/repos/minio/minio/issues{/number}","pulls_url":"https://api.github.com/repos/minio/minio/pulls{/number}","milestones_url":"https://api.github.com/repos/minio/minio/milestones{/number}","notifications_url":"https://api.github.com/repos/minio/minio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/minio/minio/labels{/name}","releases_url":"https://api.github.com/repos/minio/minio/releases{/id}","deployments_url":"https://api.github.com/repos/minio/minio/deployments","created_at":"2015-01-14T19:23:58Z","updated_at":"2016-02-23T03:50:04Z","pushed_at":"2016-02-23T07:09:29Z","git_url":"git://github.com/minio/minio.git","ssh_url":"git@github.com:minio/minio.git","clone_url":"https://github.com/minio/minio.git","svn_url":"https://github.com/minio/minio","homepage":"http://minio.io/download/","size":9336,"stargazers_count":658,"watchers_count":658,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":67,"mirror_url":null,"open_issues_count":26,"forks":67,"open_issues":26,"watchers":658,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/minio/minio/pulls/1123"},"html":{"href":"https://github.com/minio/minio/pull/1123"},"issue":{"href":"https://api.github.com/repos/minio/minio/issues/1123"},"comments":{"href":"https://api.github.com/repos/minio/minio/issues/1123/comments"},"review_comments":{"href":"https://api.github.com/repos/minio/minio/pulls/1123/comments"},"review_comment":{"href":"https://api.github.com/repos/minio/minio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/minio/minio/pulls/1123/commits"},"statuses":{"href":"https://api.github.com/repos/minio/minio/statuses/2cd4d870466218a60b6d3e8fc0e361b09f278b5c"}}}}