Allow passing logging context directly. This is better than passing a logger module with a specific class.
Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/de35f282 Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/de35f282 Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/de35f282 Branch: refs/heads/python-sdk Commit: de35f28294dfb4f47b429635eff843b38279e240 Parents: d20cf64 Author: Robert Bradshaw <rober...@google.com> Authored: Sat Jul 23 00:54:11 2016 -0700 Committer: Robert Bradshaw <rober...@google.com> Committed: Mon Jul 25 11:57:42 2016 -0700 ---------------------------------------------------------------------- sdks/python/apache_beam/runners/common.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/de35f282/sdks/python/apache_beam/runners/common.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/runners/common.py b/sdks/python/apache_beam/runners/common.py index 9c9ab22..c017704 100644 --- a/sdks/python/apache_beam/runners/common.py +++ b/sdks/python/apache_beam/runners/common.py @@ -62,7 +62,9 @@ class DoFnRunner(Receiver): context, tagged_receivers, logger=None, - step_name=None): + step_name=None, + # Preferred alternative to logger + logging_context=None): if not args and not kwargs: self.dofn = fn self.dofn_process = fn.process @@ -85,9 +87,13 @@ class DoFnRunner(Receiver): self.window_fn = windowing.windowfn self.context = context self.tagged_receivers = tagged_receivers - self.logging_context = get_logging_context(logger, step_name=step_name) self.step_name = step_name + if logging_context: + self.logging_context = logging_context + else: + self.logging_context = get_logging_context(logger, step_name=step_name) + # Optimize for the common case. self.main_receivers = as_receiver(tagged_receivers[None])