Hernán: I make myself time to answer you, and I think it can feed the
poor documentation of the Ombu package :)

>Ok, so this could be used by any application to log events? Like a
>lite version of Beacon logger?
>I am trying to get what would be the typical use case for a "common" app.

I don't know Beacon. The main features of Ombu are:

* It's optimized to write many new entries in a small window of time:
When you log something, the log writer (OmFileStore) caches it until x
milliseconds passed without activity. It was important for logging a
big project via Metacello; thousands of changes may be cached and
written in one shot.
* It's optimized to browse a large log: The OmBlockFileStore lets you
parse it by chunks. It was important for Epicea UI... when you scroll
a log with thousands of changes.
* Safe for multiple processes logging to same file: OmFileStore uses a
"Semaphore forMutualExclusion".
* Safe for multiple images logging to same directory: Suppose you are
logging stuff, then save the image and, without closing it, you
re-open the image file (spawn) and continue logging... you must avoid
conflicts that could make a log file be inconsistent. To support this
case a similars, OmSessionStore checks if the "Smalltalk session"
changed before writing a new entry in a log. If it changed, the new
entry will be automatically written into a different file.
* Link log files: For example, this information is used in Epicea UI
when you click on "link logs".

Also, I wrote a script in latest Pharo 7 (below). It shows only basic usage:

"Create store in a directory"
directory := FileSystem workingDirectory / 'mylogs'.
directory ensureCreateDirectory.
store := OmSessionStore newWithBaseLocator: directory.

"Write 2 objects (serialized via STON)"
store
    newEntry: (OmEntry content: 'first');
    newEntry: (OmEntry content: 'second').


"Force start writing to a new file. This happens with you re-open an image"

store writingFileReference.
"--> [...] /mylogss/Pharo.938mzjzhbnpo7suavqkhflnr0.ombu"

store resetWithNextStoreName.

store writingFileReference.
"--> [...] /mylogss/Pharo.938mzjt0jwolhkcqd83ji1e7h.ombu"


"Write 2 objects more in the new file"
store
    newEntry: (OmEntry content: 'third');
    newEntry: (OmEntry content: 'fourth').

"(NOW BROKEN) No matter where entries were written, you can access the
complete sequence easily."
store entries.
"--> an OrderedCollection(an OmEntry('first') an OmEntry('second') an
OmEntry('third') an OmEntry('fourth'))"


Regards,
Martín

Reply via email to