eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'LoggingStream':

Home

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

Class: LoggingStream


Inheritance:

   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

Description:


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:]

copyright

COPYRIGHT (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.

Class protocol:

instance creation
o  on: aStream
Create & return a new instance for aStream, logging to the Transcript.

o  on: aStream logger: aLoggerStream
Create & return a new instance for aStream, logging to aLoggerStream.


Instance protocol:

accessing
o  loggedStream

o  loggedStream: something

o  logger

o  logger: something

initialization
o  initializeOn: aStream logger: aLogger

logging
o  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
o  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
o  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

o  flush
(comment from inherited method)
write out all buffered data - ignored here, but added
to make internalStreams protocol compatible with externalStreams

o  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).

o  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.

o  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

o  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.

o  peek

o  peekOrNil

o  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.

o  skipSeparators

o  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.



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 14:07:36 GMT