diff options
Diffstat (limited to 'policyhandler/__init__.py')
-rw-r--r-- | policyhandler/__init__.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/policyhandler/__init__.py b/policyhandler/__init__.py index a3220c4..3315706 100644 --- a/policyhandler/__init__.py +++ b/policyhandler/__init__.py @@ -1,6 +1,5 @@ -# org.onap.dcae # ================================================================================ -# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,3 +15,20 @@ # ============LICENSE_END========================================================= # # ECOMP is a trademark and service mark of AT&T Intellectual Property. + +"""policyhandler package""" + +class LogWriter(object): + """redirect the standard out + err to the logger""" + def __init__(self, logger_func): + self.logger_func = logger_func + + def write(self, log_line): + """actual writer to be used in place of stdout or stderr""" + log_line = log_line.rstrip() + if log_line: + self.logger_func(log_line) + + def flush(self): + """no real flushing of the buffer""" + pass |