Purpose of creating Screen Player, sp.py,
Adapting to screen's logging system, Player in action, Charts builder, Screen Player Structure,
Code documentation
15. sp.py sp.py is a Python utility, enabling you to access all the Screen Player's functionality rapidly Works with Python >= 2.5
16. sp.py sp.py by itself does not provide and does not implement any functionality, instead it provides a set of tasks, each of which can handle different work arguments sp.py
17. sp.py Screen Player provides multi-level config system. Any command line option for a specified task can be stored in config section, named after the task. Options at the level with higher priority override the same options at The level with lower priority. For example to set option -s STEP, --step=STEP for 'sp.py play': [play] step = 10 Levels priority order (ascending) Config system in Screen Player Execute task sp.py -с (--config) for any task
29. Adapting to screen's logging system Track log file size and writing time stamps manually, sp.py track This command shows help for the task : To start tracking a file logfile.txt and producing stamps to logfile.txt.times , use this: To start tracking a file logfile.txt and producing stamps to custom stamps file, use this: Option --storage enables you to choose a type of the storage for the time-stamps: pickle, csv etc.
30. Adapting to screen's logging system Splitting the log file with built-in stamps to separate time stamps storage and clean log data, sp.py split Let us split the log file logfile_dirty.txt with built-in stamps, produce the clean log to logfile_clean.txt and store time stamps In logfile_clean.txt.times (adjusted implicitly): If you need just to clean up the log file from the built-in time stamps, use flag – c . In this case time stamps won't be stored. Type of the time stamps storage can be set by a flag --storage
31. Player in action Playback of the log file, having separate time-stamps and log files, sp.py play To start playing back a log file logfile.txt , when the time stamps storage is logfile.times, use this: -t option will let you set the time stamps storage explicitly. Start from the specified moment of time, defining a start point using a --jump(-j) option. A value has to be a screen player's ISO 8601 time stamp.
32. Playback of the log file with built-in time-stamps Player in action Assume, that you have a large log file, produced by screen with “ logtstamp” option on, and you want to play it back easily, not having to worry about the separate time-stamps storage and “clean” log file. Use -d (--dirty) option:
33. Player in action Screen player's ISO 8601 date/time format A basic format of the date/time in ISO 8601 is: Screen player offers optional ISO 8601 format, when any count of the parameter can be omitted and inherited from the default date/time. For example: In ' sp.py play' our stamp is based on a default stamp – first one from the time stamps storage, here we omitted the month, day, hour and Time zone – all this parameters will be inherited from the default stamp
34. Adapting to screen's logging system Investigating the time line, sp.py tinfo Let us retrieve the information about the time line, using time stamps storage logfile.times. The command shows the start & end points, count of stamps, full duration of the time line: To write all the time stamps to a file as CSV values, use flag -- all :
35. Player in action List of the shortcuts can be retrieved using this command: Controlling the playback. Player shortcuts To adjust the size of the step, made when jumping back/forward: --step <seconds> option
37. Charts builder Screen player allows you to investigate the load and busyness of the 'screen' terminal in visual mode – drawing the statistics chart. This facility enables you to compare busyness of terminal in different periods of time, assess rise and falls in terminal activity, make conclusions.
38. Charts builder Chart building functionality can be accessed by sp.py 'chart' task. Let us build a chart, showing the activity of the terminal, which was being logged. Let us save the image, produced to a file image.png, with size 800x100 Our image.png may look like this now:
39. Charts builder Google charts sp.py chart functionality is based on Google Charts service from Google Inc. [4]
41. Structure sp.py – Python executable module, uses “screenlog” Python package. A package encapsulates the Screen Player functionality. Consists of several modules. Inside of the Screen Player sp.py screenlog package Gathering tasks – modules with __task__ attribute player.py timeparser.py tracker.py splitter.py statchart.py util.py __init__.py
44. Code documentation Doctests Screen Player code is well documented, doctests are included in the code into the docstrings. Screen Player offers an uility to test all the modules of “screenlog” by once:
45. Code documentation Epydoc Screen Player supports 'epydoc' documentation, it enables you to generate documentation in PDF or HTML format For example to generate HTML documentation for “screenlog” package, install Epydoc [5] and type: