eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'TraceBuffer':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: TraceBuffer


Inheritance:

   Object
   |
   +--Collection
      |
      +--SequenceableCollection
         |
         +--ArrayedCollection
            |
            +--Array
               |
               +--TraceBuffer

Package:
stx:libbasic3
Category:
System-Debugging-Support
Version:
rev: 1.7 date: 2022/03/21 21:36:25
user: stefan
file: TraceBuffer.st directory: libbasic3
module: stx stc-classLibrary: libbasic3

Description:


simple round robin tracebuffer for system debugging.
Create a traceBuffer for max. n entries with new:<n>.

Add a trace with #trace:msg

Dump the last <n> trace entries with dumpLast:<n> on:aStream

Dump all captured entres with dumpOn:aStream.

copyright

COPYRIGHT (c) 2010 by Claus Gittinger All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

instance creation
o  new: n
return an initialized instance


Instance protocol:

dumping
o  dumpLast: n on: aStream
the index of the last written entry

o  dumpOn: aStream
dump the captured log entries into aStream

initialization
o  initialize
(comment from inherited method)
just to ignore initialize to objects which do not need it

o  isEmpty
return the number of log entries in the buffer
writeIndex is only 0 initially;
otherwise, the writeIndex after round robin is the array size

o  removeAll
(comment from inherited method)
remove all elements from the receiver. Returns the receiver.

For ArrayedCollections (which are actually fixed-size collections),
this is a slow operation, since a #become: is required to update
all owners. Better use a collection which is prepared for growing
(i.e. an OrderedCollection).
We output a warning message here, to remind you about that.

tracing
o  trace: aMessage


Examples:


|buffer|
buffer := self new:100.
buffer dumpLast:5 on:Transcript.
buffer trace:1.
buffer trace:2.
buffer trace:3.
buffer dumpLast:5 on:Transcript.
buffer trace:4.
buffer trace:5.
buffer dumpLast:5 on:Transcript.
buffer trace:6.
buffer trace:7.
buffer trace:8.
buffer dumpLast:5 on:Transcript.

|buffer|
buffer := self new:5.
buffer dumpLast:5 on:Transcript.
buffer trace:1.
buffer trace:2.
buffer trace:3.
buffer dumpLast:5 on:Transcript.
buffer trace:4.
buffer trace:5.
buffer dumpLast:5 on:Transcript.
buffer trace:6.
buffer trace:7.
buffer trace:8.
buffer dumpLast:5 on:Transcript.

|buffer|
buffer := self new:10.
buffer dumpOn:Transcript.
buffer trace:1.
buffer trace:2.
buffer trace:3.
buffer dumpOn:Transcript.
buffer trace:4.
buffer trace:5.
buffer dumpOn:Transcript.
buffer trace:6.
buffer trace:7.
buffer trace:8.
buffer dumpOn:Transcript.
buffer trace:9.
buffer trace:10.
buffer trace:11.
buffer dumpOn:Transcript.
buffer trace:12.
buffer trace:13.
buffer trace:14.
buffer trace:15.
buffer trace:16.
buffer trace:17.
buffer trace:18.
buffer trace:19.
buffer trace:20.
buffer trace:21.
buffer trace:22.
buffer trace:23.
buffer dumpOn:Transcript.


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 16:46:06 GMT