{"action":"created","issue":{"url":"https://api.github.com/repos/JukkaL/mypy/issues/1051","labels_url":"https://api.github.com/repos/JukkaL/mypy/issues/1051/labels{/name}","comments_url":"https://api.github.com/repos/JukkaL/mypy/issues/1051/comments","events_url":"https://api.github.com/repos/JukkaL/mypy/issues/1051/events","html_url":"https://github.com/JukkaL/mypy/issues/1051","id":120580710,"number":1051,"title":"Suggestion: write messages to stdout instead of stderr","user":{"login":"gvanrossum","id":2894642,"avatar_url":"https://avatars.githubusercontent.com/u/2894642?v=3","gravatar_id":"","url":"https://api.github.com/users/gvanrossum","html_url":"https://github.com/gvanrossum","followers_url":"https://api.github.com/users/gvanrossum/followers","following_url":"https://api.github.com/users/gvanrossum/following{/other_user}","gists_url":"https://api.github.com/users/gvanrossum/gists{/gist_id}","starred_url":"https://api.github.com/users/gvanrossum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gvanrossum/subscriptions","organizations_url":"https://api.github.com/users/gvanrossum/orgs","repos_url":"https://api.github.com/users/gvanrossum/repos","events_url":"https://api.github.com/users/gvanrossum/events{/privacy}","received_events_url":"https://api.github.com/users/gvanrossum/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JukkaL/mypy/labels/enhancement%20proposal","name":"enhancement proposal","color":"bfdadc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-12-05T19:11:56Z","updated_at":"2015-12-07T02:11:14Z","closed_at":null,"body":"I often want to grep mypy's output for certain messages (or to strip certain messages) and this is a little tricky because the messages are written to stderr. So I have to do e.g.\r\n```\r\nmypy file.py 2>&1 | grep -v note\r\n```\r\ninstead of\r\n```\r\nmypy file.py | grep -v note\r\n```\r\nI think the only things that should be written to stderr are command line syntax errors (where it refuses to run) or fatal errors like tracebacks. Syntax errors in the modules to be analyzed should probably go to stdout (though since these abort processing it might be okay to send these to stderr).\r\n\r\nAlso -h output should go to stdout IMO (this is how argparse does things -- it would also be nice to rewrite the argument parsing using argparse)."},"comment":{"url":"https://api.github.com/repos/JukkaL/mypy/issues/comments/162389293","html_url":"https://github.com/JukkaL/mypy/issues/1051#issuecomment-162389293","issue_url":"https://api.github.com/repos/JukkaL/mypy/issues/1051","id":162389293,"user":{"login":"darjus","id":177063,"avatar_url":"https://avatars.githubusercontent.com/u/177063?v=3","gravatar_id":"","url":"https://api.github.com/users/darjus","html_url":"https://github.com/darjus","followers_url":"https://api.github.com/users/darjus/followers","following_url":"https://api.github.com/users/darjus/following{/other_user}","gists_url":"https://api.github.com/users/darjus/gists{/gist_id}","starred_url":"https://api.github.com/users/darjus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darjus/subscriptions","organizations_url":"https://api.github.com/users/darjus/orgs","repos_url":"https://api.github.com/users/darjus/repos","events_url":"https://api.github.com/users/darjus/events{/privacy}","received_events_url":"https://api.github.com/users/darjus/received_events","type":"User","site_admin":false},"created_at":"2015-12-07T02:11:14Z","updated_at":"2015-12-07T02:11:14Z","body":"I'm not too familiar with mypy codebase yet but could we use standard python logging facilities?\r\n\r\nI remember seeing an issue where Jukka discusses warning messages and that currently everything's an error in mypy and it would be useful to support both. By using logging and handlers we could support this quite easily and could give extra flexibility on what to print where/when.\r\n\r\n    log = logging.getLogger(__name__)  # or maybe different name/namespace\r\n    log.debug(\"Various debug messages that would be printed to STDOUT if --debug or -vv was passed in with line numbers and additional formatting information useful for debugging\")\r\n    log.info(\"Various informational messages (for example: checking file spam/eggs.py) that would be enabled with --verbose\")\r\n    log.warn(\"Would print STDOUT warning messages relating to various warnings in code being checked\")\r\n    log.error(\"Woud print STDOUT errors relating to errors in code being checked\")\r\n    log.critical(\"Would print STDERR various critical things we've touched up on above\")"}}