Maagan-Michael / net-n

Micro ISP management system
https://maagan-michael.github.io/net-n/
MIT License
1 stars 2 forks source link

[backend]: add a logger for all mutations and errors #7

Open nathanschwarz opened 11 months ago

nathanschwarz commented 11 months ago
nathanschwarz commented 11 months ago

@yarons when upserting do we need to log the exact changes (fields / new values) ?

yarons commented 11 months ago

Yes fully but I think we should make it clear what exactly is happening:

  1. A replacement template - [INFO] {timestamp - {actor}: Family {family} moved from residence {old_residence} to residence {new_residence}.
  2. Assignment - [INFO] {timestamp} - {actor}: Family {family} was assigned to {new_residence}.
  3. Displacement - [WARN] {timestamp} - {actor}: Family {family} was displaced.
  4. Failure - [ERROR] {timestamp} - {actor}: Family {family} was not assigned to {new_residence}, Reason: {reason}.

First case informs of a successful transaction where the former house was detached, the new house was assigned and the budget is sufficient. Second case informs of a successful transaction where for some reason this family was previously displaced due to some error (either budget or technical). Third case is a warning since the user was displaced but not reassigned (if it's a UI decision it's intentional and informational but should popup a warning message saying that it wasn't assigned, if it's done by a script it's a warning) these cases happen either when there's insufficient funds or the user is leaving the Kibbutz. Fourth case is clearly an error, since it might be the outcome of insufficient funds or technical error (API inaccessible) etc.

The technical errors may include:

  1. Inaccessible Ma'alé/Oracle DB (Ingestion).
  2. Inaccessible Internal DB/Postgres (Processing/Storage).
  3. Inaccessible controller (IMC/SNMP/etc.)

Thanks.

nathanschwarz commented 10 months ago