Definition of the needs
The problem, and what is aimed at
The framework says things: a name no set carries, a theme it was asked for and does not know, a file it could not read. Whoever writes the page wants to hear them while writing, and wants silence once the page is written. Whoever reads the page wants to hear nothing at all.
Today the level is a call, WexaLogger.setLogLevel(), and
nothing else: a page that loads the framework by its tag has no way of
saying it, and a call made after the loading arrives after the messages it
was meant to silence. That is what this dossier is written for.
Elicitation of the needs
Three things are handled, and they are all that is handled.
L1. A message is what the framework says: a text, and what went with it when something went wrong.
L2. A severity is how much a message weighs. Five of them, counted as Python counts them: debug 10, info 20, warning 30, error 40, critical 50.
L3. The level is what a document lets through: a message of a severity below it is not said. One level at a time, for the whole document.
Organisation of the needs
L10 Saying the level
- L11 The author fixes the level of what the framework says.
- L12 The author fixes it where he already says what the page loads, and without writing a line of JavaScript.
- L13 The level is in force before the first message: what is said while the framework loads is subject to it.
- L14 A page that says nothing keeps the level the framework holds, which lets through what a written page has no reason to hide.
- L15 The author can change the level once the page is open, to hear more of what he is looking at.
L20 What is said
- L21 A message says which framework said it, so that it is not taken for the page's own.
- L22 A message of a severity below the level is not said, and costs nothing.
- L23 What is critical is said whatever the level: it is what the author cannot choose to ignore.
- L24 Nothing is said to the reader: what is said goes to the console and nowhere else.
L30 What is guaranteed
- L31 A level nobody understands changes nothing, and the page holds.
- L32 Nothing of what is said leaves the document: nothing is sent, nothing is kept.
What was set aside
A level per module, so that one component may be heard and not the others. A history kept in the page. Sending what was said to a server.
Saying the level in the address, as the theme and the set of icons are said there. What a document says of itself is the author's, and nobody else's: an address that raised the level would make a page say more than whoever wrote it chose.
The constraints
What the code holds to
| No. | Constraint | Comes from |
|---|---|---|
| C1 | The level is read before anything of the framework runs: a level read afterwards is a level that arrives after the messages | L13 |
| C2 | One level at a time, for the whole document: two parts of a page that heard differently would not say where a message came from | L3 |
| C3 | What the page writes is a name or a number, and what it does not write is the level the framework holds | L11, L14, L31 |
| C4 | A message below the level costs nothing more than the comparison: what is not said is not built | L22 |
| C5 | Whatever is said is said to the console of the browser, and to nothing else | L24, L32 |
The decisions
The decisions of the tool
D1. The level is written on the namespace, before the framework
starts. Wexa.logLevel = 'debug' in a script placed before
the loader: the object is made by whoever gets there first, and the
framework reads it as it reads what a build gathered for it. A call cannot
do it — Wexa does not exist before the framework is there, and
a call made after it arrives once the messages of the loading have already
passed (L13, C1).
D2. A name or a number, as Python writes them.
'debug' or 10, 'info' or
20, and so on to 'critical' and 50.
What is understood by neither changes nothing (C3, L31).
D3. Nothing said, the level is 20. Info, as Python counts it: what the framework says of itself as it starts is heard, and a page that wants silence says so (L14).
D4. The call stays. Wexa.logger.setLogLevel() is what
changes the level once the page is open, for an author looking at what he
is writing (L15). It is not what a page uses to say its level.