|
Class: LoggingStream
Object
|
+--Stream
|
+--LoggingStream
- Package:
- stx:libbasic2
- Category:
- Streams-Misc
- Version:
- rev:
1.11
date: 2021/04/09 18:07:16
- user: cg
- file: LoggingStream.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
Useful for debugging - stream operations are logged in human readable form
on a separate logger stream, while stream operations are forwarded to the underlying
loggedStream.
Unfinished - may need more protocol to be intercepted.
sample use, logging operations on a socket stream:
sock := ... Socket connectTo: ...
s := LoggingStream new loggedStream: sock.
...
use s instead of sock
...
[instance variables:]
[class variables:]
copyrightCOPYRIGHT (c) 2013 by eXept Software AG
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.
instance creation
-
on: aStream
-
Create & return a new instance for aStream, logging to the Transcript.
-
on: aStream logger: aLoggerStream
-
Create & return a new instance for aStream, logging to aLoggerStream.
accessing
-
loggedStream
-
-
loggedStream: something
-
-
logger
-
-
logger: something
-
initialization
-
initializeOn: aStream logger: aLogger
-
logging
-
log: messageString
-
(comment from inherited method)
same as showCR:.
Added to allow for Transcript.log(...) to be used in a similar way as console.log(...).
(and, by the way, JS-actions in expecco see a binding for console -> Transcript.
Not for non-JavaScript usage
reading
-
next
-
(comment from inherited method)
return the next element of the stream
- we do not know here how to do it, it must be redefined in subclass
stream protocol
-
atEnd
-
(comment from inherited method)
return true if the end of the stream has been reached;
- we do not know here how to do it, it must be redefined in subclass
-
flush
-
(comment from inherited method)
write out all buffered data - ignored here, but added
to make internalStreams protocol compatible with externalStreams
-
next: n
-
(comment from inherited method)
return the next count elements of the stream as aCollection,
which depends on the stream's type - (see #contentsSpecies).
-
nextBytes: n
-
(comment from inherited method)
read the next count bytes and return it as a byteArray.
If EOF is encountered while reading, a truncated byteArray is returned.
If EOF is already reached before the first byte can be read,
an error is raised if signalAtEnd is set, or nil is returned if not.
-
nextPut: something
-
(comment from inherited method)
put the argument, anObject onto the receiver
- we do not know here how to do it, it must be redefined in subclass
-
nextPutAll: aCollection
-
(comment from inherited method)
put all elements of the argument, aCollection onto the receiver.
Answer the receiver.
This is only allowed, if the receiver supports writing.
-
peek
-
-
peekOrNil
-
-
readWait
-
(comment from inherited method)
suspend the current process, until the receiver
becomes ready for reading. If data is already available,
return immediately.
The other threads are not affected by the wait.
-
skipSeparators
-
-
upToEnd
-
(comment from inherited method)
return a collection of the elements up-to the end.
Return an empty collection, if the stream is already at the end.
|