@@ -227,6 +227,47 @@ args, kw)``. For example::
227227This will execute the code `f(1, n=int(1e6)) ` and return the memory
228228consumption during this execution.
229229
230+ =====
231+ REPORTING
232+ =====
233+
234+ The output can be redirected to a log file by passing IO stream as
235+ parameter to the decorator like @profile(stream=fp)
236+
237+ >>> fp= open (' memory_profiler.log' ,' w+' )
238+ >>> @ profile(stream = fp)
239+ >>> def my_func ():
240+ ... a = [1] * (10 ** 6)
241+ ... b = [2] * (2 * 10 ** 7)
242+ ... del b
243+ ... return a
244+
245+ For details refer: examples/reporting_file.py
246+
247+ ``Reporting via logger Module: ``
248+
249+ Sometime it would be very convenient to use logger module specially
250+ when we need to use RotatingFileHandler.
251+
252+ The output can be redirected to logger module by simply making use of
253+ LogFile of memory profiler module.
254+
255+ >>> from memory_profiler import LogFile
256+ >>> import sys
257+ >>> sys.stdout = LogFile(' memory_profile_log' )
258+
259+ ``Customised reporting: ``
260+
261+ Sending everything to the log file while running the memory_profiler
262+ could be cumbersome and one can choose only entries with increments
263+ by passing True to reportIncrementFlag, where reportIncrementFlag is
264+ a parameter to LogFile class of memory profiler module.
265+
266+ >>> from memory_profiler import LogFile
267+ >>> import sys
268+ >>> sys.stdout = LogFile(' memory_profile_log' , reportIncrementFlag = False )
269+
270+ For details refer: examples/reporting_logger.py
230271
231272=====================
232273 IPython integration
@@ -348,6 +389,8 @@ cleanup.
348389
349390`Thomas Kluyver <https://github.com/takluyver >`_ added the IPython extension.
350391
392+ `Sagar UDAY KUMAR <https://github.com/sagaru >`_ added Report generation feature and examples.
393+
351394
352395=========
353396 License
0 commit comments