Skip to content

Commit 891a3a7

Browse files
authored
Merge pull request #99 from deep-compute/bugfix-hooks-to-processors
references #98, fixed the issue and tested the hello world example wo…
2 parents 0319d90 + c0bc0f9 commit 891a3a7

3 files changed

Lines changed: 8 additions & 20 deletions

File tree

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ deploy:
1919
- basescript/utils.py
2020
- examples/adder.py
2121
- examples/helloworld.py
22-
name: basescript-0.3.3
23-
tag_name: 0.3.3
22+
name: basescript-0.3.4
23+
tag_name: 0.3.4
2424
true:
2525
repo: deep-compute/basescript
2626
- provider: pypi

basescript/basescript.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ def __init__(self, args=None):
5151
quiet=self.args.quiet,
5252
level=self.args.log_level,
5353
fpath=self.args.log_file,
54-
pre_hooks=self.define_log_pre_format_hooks(),
55-
post_hooks=self.define_log_post_format_hooks(),
54+
processors=self.define_log_processors(),
5655
metric_grouping_interval=self.args.metric_grouping_interval,
5756
minimal=self.args.minimal,
5857
)
@@ -92,25 +91,14 @@ def start(self):
9291
def name(self):
9392
return ".".join([x for x in (sys.argv[0].split(".")[0], self.args.name) if x])
9493

95-
def define_log_pre_format_hooks(self):
94+
def define_log_processors(self):
9695
"""
97-
these hooks are called before the log has been rendered, but after
98-
all necessary filtering by log_processors has taken place.
99-
they must accept a single argument which is a dictionary.
96+
These processors are called before a log is rendered but after
97+
all necessary filtering by the default log processors has taken
98+
place. They must have the function signature required by `structlog`
10099
"""
101100
return []
102101

103-
def define_log_post_format_hooks(self):
104-
"""
105-
these hooks are called after the log has been rendered using
106-
the log renderer defined in `define_log_renderer`.
107-
they must accept a single argument which is the output of the
108-
renderer
109-
"""
110-
# TODO remove this once structlog supports hooks or handlers
111-
# these hooks accept a 'msg' and do not return anything
112-
return []
113-
114102
def define_subcommands(self, subcommands):
115103
"""
116104
Define subcommands (as defined at https://docs.python.org/2/library/argparse.html#sub-commands)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def get_long_description():
2525

2626
long_description = get_long_description()
2727

28-
version = "0.3.3"
28+
version = "0.3.4"
2929
setup(
3030
name="basescript",
3131
version=version,

0 commit comments

Comments
 (0)