[2/4] p.haul: log few blank lines before each run

Submitted by Nikita Spiridonov on April 21, 2016, 12:46 p.m.

Details

Message ID 1461242792-635567-3-git-send-email-nspiridonov@virtuozzo.com
State New
Series "improve p.haul logging"
Headers show

Commit Message

Nikita Spiridonov April 21, 2016, 12:46 p.m.
Since phaul and phaul-service don't overwrite logs anymore,
log few blank lines before each run to make logs more readable.

Signed-off-by: Nikita Spiridonov <nspiridonov@virtuozzo.com>
---
 p.haul         |    2 ++
 p.haul-service |    2 ++
 phaul/util.py  |    6 ++++++
 3 files changed, 10 insertions(+), 0 deletions(-)

Patch hide | download patch | download mbox

diff --git a/p.haul b/p.haul
index 98560f6..8a36d90 100755
--- a/p.haul
+++ b/p.haul
@@ -3,6 +3,7 @@ 
 import sys
 import logging
 import phaul.args_parser
+import phaul.util
 import phaul.iters
 import phaul.connection
 
@@ -36,6 +37,7 @@  logging.basicConfig(filename=args.log_file, filemode="a", level=logging.INFO,
 # Setup hook to log uncaught exceptions
 sys.excepthook = log_uncaught_exception
 
+phaul.util.log_header()
 logging.info("Starting p.haul")
 
 # Establish connection
diff --git a/p.haul-service b/p.haul-service
index b3cbc1c..6fe33ea 100755
--- a/p.haul-service
+++ b/p.haul-service
@@ -4,6 +4,7 @@  import sys
 import signal
 import logging
 import phaul.args_parser
+import phaul.util
 import phaul.xem_rpc
 import phaul.service
 import phaul.connection
@@ -30,6 +31,7 @@  logging.basicConfig(filename=args.log_file, filemode="a", level=logging.INFO,
 # Setup hook to log uncaught exceptions
 sys.excepthook = log_uncaught_exception
 
+phaul.util.log_header()
 logging.info("Starting p.haul service")
 
 # Establish connection
diff --git a/phaul/util.py b/phaul/util.py
index 2482570..9cca073 100644
--- a/phaul/util.py
+++ b/phaul/util.py
@@ -78,3 +78,9 @@  def makedirs(dirpath):
 			pass
 		else:
 			raise
+
+
+def log_header():
+	OFFSET_LINES_COUNT = 3
+	for i in range(OFFSET_LINES_COUNT):
+		logging.info("")