Created
August 25, 2014 13:54
-
-
Save mfriedenhagen/9e4c6a2fd286b518da8d to your computer and use it in GitHub Desktop.
Strange logging behaviour in hooks (debug level activated resp. handler message shown) (https://github.com/bundlewrap/bundlewrap/issues/130)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import logging | |
def _post_message(message): | |
""" | |
Will not create a logging message but emit a warning: No handlers could be found for logger "simple_logger" | |
""" | |
logging.getLogger("simple_logger").warn(message) | |
def _short_rev(repo): | |
return repo.revision[:8] | |
def apply_start(repo, target, nodes, interactive=False, **kwargs): | |
""" | |
Runs after resolutions. | |
""" | |
short_rev = _short_rev(repo) | |
node_names = [node.name for node in nodes] | |
_post_message("apply_start: rev: {short_rev}, target: {target}, nodes: {node_names}".format(**locals())) | |
def apply_end(repo, target, nodes, duration=None, **kwargs): | |
""" | |
Auszug aus: unknown. „BundleWrap 1.1.0 documentation.“ iBooks. https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewBook?id=9DE24FE910EBB5798FF454F3EEDBD883 | |
""" | |
short_rev = _short_rev(repo) | |
node_names = [node.name for node in nodes] | |
_post_message("apply_end: rev: {short_rev}, target: {target}, nodes: {node_names}, duration: {duration}".format(**locals())) | |
def node_apply_start(repo, node, interactive=False, **kwargs): | |
short_rev = _short_rev(repo) | |
node_name = node.name | |
_post_message("node_apply_start: rev: {short_rev} on {node_name}".format(**locals())) | |
def run_start(repo, target, nodes, command, **kwargs): | |
short_rev = _short_rev(repo) | |
node_names = [node.name for node in nodes] | |
_post_message("run_start: rev: {short_rev}, target: {target}, nodes: {node_names}, command: {command}".format(**locals())) | |
def run_end(repo, target, nodes, command, duration, **kwargs): | |
short_rev = _short_rev(repo) | |
node_names = [node.name for node in nodes] | |
_post_message("run_end: rev: {short_rev}, target: {target}, nodes: {node_names}, command: {command}, duration: {duration}".format(**locals())) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import logging | |
def _post_message(message): | |
""" | |
Will activate debug logging. | |
""" | |
logging.info(message) | |
def _short_rev(repo): | |
return repo.revision[:8] | |
def apply_start(repo, target, nodes, interactive=False, **kwargs): | |
""" | |
Runs after resolutions. | |
""" | |
short_rev = _short_rev(repo) | |
node_names = [node.name for node in nodes] | |
_post_message("apply_start: rev: {short_rev}, target: {target}, nodes: {node_names}".format(**locals())) | |
def apply_end(repo, target, nodes, duration=None, **kwargs): | |
""" | |
Auszug aus: unknown. „BundleWrap 1.1.0 documentation.“ iBooks. https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewBook?id=9DE24FE910EBB5798FF454F3EEDBD883 | |
""" | |
short_rev = _short_rev(repo) | |
node_names = [node.name for node in nodes] | |
_post_message("apply_end: rev: {short_rev}, target: {target}, nodes: {node_names}, duration: {duration}".format(**locals())) | |
def node_apply_start(repo, node, interactive=False, **kwargs): | |
short_rev = _short_rev(repo) | |
node_name = node.name | |
_post_message("node_apply_start: rev: {short_rev} on {node_name}".format(**locals())) | |
def run_start(repo, target, nodes, command, **kwargs): | |
short_rev = _short_rev(repo) | |
node_names = [node.name for node in nodes] | |
_post_message("run_start: rev: {short_rev}, target: {target}, nodes: {node_names}, command: {command}".format(**locals())) | |
def run_end(repo, target, nodes, command, duration, **kwargs): | |
short_rev = _short_rev(repo) | |
node_names = [node.name for node in nodes] | |
_post_message("run_end: rev: {short_rev}, target: {target}, nodes: {node_names}, command: {command}, duration: {duration}".format(**locals())) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment