diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-09-01 17:01:29 +0100 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-09-01 17:01:29 +0100 |
commit | 1d58cf3206bc5e288986649e4258bbc6bddb3ead (patch) | |
tree | dabe142892c2b49461fc2ca4c21acaef0b9a6b0a | |
parent | 768e839e361760e5e5660aaff889ea22ed445a04 (diff) | |
download | morph-1d58cf3206bc5e288986649e4258bbc6bddb3ead.tar.gz |
import: Fix logging in plugins
-rwxr-xr-x | import/rubygem.to_chunk | 4 | ||||
-rwxr-xr-x | import/rubygem.to_lorry | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/import/rubygem.to_chunk b/import/rubygem.to_chunk index 7156c9d3..9e802e73 100755 --- a/import/rubygem.to_chunk +++ b/import/rubygem.to_chunk @@ -62,7 +62,9 @@ BUILD_DEPENDENCY_WHITELIST = [ # recommended here: # <https://stackoverflow.com/questions/1681745/share-global-logger-among-module-classes> # -log_file = ENV['BASEROCK_IMPORT_LOG'] or '/dev/null' +log_file = ENV['BASEROCK_IMPORT_LOG'] || '/dev/null' + +if log_file.length == 0 then log_file = '/dev/null' end Log = Logger.new(log_file) diff --git a/import/rubygem.to_lorry b/import/rubygem.to_lorry index 25f0ecd9..60e9d925 100755 --- a/import/rubygem.to_lorry +++ b/import/rubygem.to_lorry @@ -156,12 +156,12 @@ class RubyGemLorryGenerator(object): def setup_logging(): - stream = os.environ.get('BASEROCK_IMPORT_LOG', None) + stream_name = os.environ.get('BASEROCK_IMPORT_LOG', '') level = os.environ.get('BASEROCK_IMPORT_LOG_LEVEL', 'info') level_id = logging._levelNames.get(level.upper(), logging.INFO) - if stream is not None: - logging.basicConfig(stream=open(stream, 'a'), level=level_id) + if len(stream_name) > 0: + logging.basicConfig(stream=open(stream_name, 'a'), level=level_id) def write_lorry(stream, lorry): |