summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Burry <bburry@etsy.com>2015-09-09 07:57:11 -0700
committerBen Burry <bburry@etsy.com>2015-11-13 17:34:42 +0000
commitaf42233f8da119fe0565b7d313705e6d64b6a3c3 (patch)
tree96059d19654ea0a0a65c7c276c4e1ef25ddadc96
parentdc85a5608182f31c908b1ea9acd31bbd33865188 (diff)
downloadlogster-af42233f8da119fe0565b7d313705e6d64b6a3c3.zip
logster-af42233f8da119fe0565b7d313705e6d64b6a3c3.tar.gz
logster-af42233f8da119fe0565b7d313705e6d64b6a3c3.tar.bz2
Simplify code formatting of unwieldy oneliner
-rwxr-xr-xbin/logster14
1 files changed, 7 insertions, 7 deletions
diff --git a/bin/logster b/bin/logster
index 8fc90e1..d2f41be 100755
--- a/bin/logster
+++ b/bin/logster
@@ -66,18 +66,18 @@ state_dir = "/var/run"
# Find all built-in output classes and store them against their shortname
-builtin_output_classes = dict(
- [(cls.shortname, cls) for name, cls in inspect.getmembers(logster.outputs.builtin)
- if inspect.isclass(cls) and issubclass(cls, LogsterOutput) and not cls is LogsterOutput
- ]
-)
+# Built-in output classes are in the logster.outputs.builtin module, extending LogsterOutput
+builtin_outputs = dict([(cls.shortname, cls)
+ for _, cls in inspect.getmembers(logster.outputs.builtin)
+ if inspect.isclass(cls) and issubclass(cls, LogsterOutput) and not cls is LogsterOutput
+])
# optparse callback to locate output class by shortname or full path
def load_output_klass(option, opt, value, parser):
outputs = getattr(parser.values, option.dest) if getattr(parser.values, option.dest) else []
- output_klass = builtin_output_classes.get(value)
+ output_klass = builtin_outputs.get(value)
if not output_klass:
# Assume full path if shortname not found in builtin outputs
try:
@@ -147,7 +147,7 @@ cmdline.add_option('--log-conf', action='store', default=None,
help='Logging configuration file. None by default')
cmdline.add_option('--output', '-o', action='callback', callback=load_output_klass, type="string", dest="output", metavar="OUTPUT",
help="Where to send metrics (can specify multiple times).\
- Choices are %s or a fully qualified Python class name" % ', '.join(builtin_output_classes.keys()))
+ Choices are %s or a fully qualified Python class name" % ', '.join(builtin_outputs.keys()))
cmdline.add_option('--dry-run', '-d', action='store_true', default=False,
help='Parse the log file but send stats to standard output.')
cmdline.add_option('--debug', '-D', action='store_true', default=False,