Simple LOG app - Former main topic [Deprecated]

Okay, BLL and SSL are both in test.
Better Logic Library (test) | Homey
Simple (Sys) LOG (test) | Homey

Please let me know how it works!

@Peter and others
Question:

image

Should i add the new Niveau and Category fields as optional arguments to existing flowcards?

Or should i create one new “master” Flowcard for writing the new logs?

If i add it to existing, you can easily goto flows and give it extra info if you want. However, you’r flows might look a bitt messed up if flowcards get more arguments out of nothing.

I can also leave the cards the way the are right now and Add one new “master” flowcard.

What do you people think?

Confirmed, great to have it back in mobile app :pray:

Just wait:


Real excel with real Date objects etc. :slight_smile:

Only cost me 120kB install size: total for the SSL app: 700kB right now install size :slight_smile:

1 Like

In test now:

Export as Excel (and csv and json).

P.s. Run the Delete Complete Log Flowcard, there was a duplication issue with the app/group name indexes.

For me, just two cards would do, one with the timeline and one without.
“Add [message] to the log and timeline, {optional} group name [groupname] with {optional} level [severity level] of {optional} [category]”
I don’t mind if existing cards get the empty optional fields added.

An other request, I would like the flowname to be available as argument/tag/token/pre-filled log entry, is that possible?
Maybe combined with DC app possibility of “Get flow containing … filtered [current flow] …”?
The card would be something like:
“Add [message] [current_flowname] to the log and timeline, {optional} group name [groupname] with {optional} level [severity level] of {optional} [category]”

YES, export as Excel & JSON works with both web and mobile.

Just not to big files on HP2023 right now, not sure why.
(But it’s still a test version ;))

Yeah Peter, if that was available, Apps would be even nicer.
But unfortuantly, apps or flowcards do not have any info about the flow that it executes.

There is still afaik no way to know that. I wish i did.

Only thing is setting it “once” right, so when you would create a script to auto add or edit all logcards, there it could be filled with the flow name.
But change the flowname, and you would need to update the log-card as well (be it by hand or with a script).

Current-flow(-execution) would be nice to know

Right, just a to big file to pass through the AppApi…
Solving it without…

We can’t have it all :wink:

But THAT would be awesome already!


Ofcourse changing a flowname doesn’t auto adjust the flowname on the logcard. But also Homey itself doesn’t handle changed flownames and logics variables 100%. You have to fix your flows afterwards.

For me, when flow(s) are (kind of) finished and running as expected, I seldom change their name afterwards.
So not sure how often other Homey’s change their flownames in general.

1 Like

Now that i have a great Syslog app, ill certainly look into adding flowcards by default.

Btw, SSL and BLL are both in test:
Large files can now be downloaded, like 10MB logs in excel, json or csv.

Good night!

2 Likes

Thanks again for all your effort, Arie.
Night night.

1 Like

I am considering QlusterIT / nl.qluster-it.SimpleLog / issues / #4 - Add a syslog-interface — Bitbucket as Resolved/Build and closing it there.

1 Like

Okay, i have done it like this:

  • One card is now deprecated.

  • There is one simpel Log card.

  • There is one simpel Timeline card.

  • There is one advanced Log card with all optional fields (except timeline).

  • There is one advanced Log card with all optional fields with timeline.

1 Like

How will upgrade from old to new app go?

I have a large amount of flows with simple log card in them using the card with group+info in the log.

Firstly, don’t yet upodate to TEST if you use Simple Log for real. It’s not yet ready, it’s got work to do still and testing.

I have already build a convertion that, if you have old logs, on app start it will be transformed into the new logs.
All flowcards that already exists will keep working the way you are used to.
I have deprecated a few cards, meaning, you cannot select them anymore (in test still ofc) when you want to add a flowcard to a flow.
But existing cards will keep working an flows will keep working (this is basic Homey funcitonality to deprecate a card).

So, when al is ready (and well tested) an update to SSL 3.0 (Simple (Sys) LOG) should go “unnoticed”.
Only “issue” currently is that the Better Logic Library is required.

Currently you will get a nice Timeline warning when SSL is starting and BLL is not installed and SSL will shutdown (until BLL is installed). No real fush or anything, and a nice working script to make sure the BLL is loaded before SSL after a Homey restart.

However: Athom has just build in something to kinda prevent that or at least there is a timeout for apps not loading in time… So i need to find another work around c.q. fix it, else, with the current existing apps in live, when Athom pushes this update of there’s, a lott of apps are gonna be broken, like SSL (used BLL coding already), Google Services, FTP Client, BLL itself (it runs it modules through it’s own module-supply methods).

Okay, the new Simple (Sys) LOG version 2.9.16 (almost version 3) is in test:

It works on all Homey Pro’s, no more timers or delay on app init.

Who wants to test?

The old log will be automaticly converted into the new log.

3 Likes

@Peter_Kawa

Here is a script i am starting to place in the DC app, so you can generate scripts too add Loggers like Simple Log or Papertrails.

You can run this in the Api Playground
When deleteCards is set to true, it will delete all cards that are automaticly generated through this script.
When set to false, all flowcards will get an logger appended to it, with a unique code, placed behind the original flowcards.

You can also set the flownames (as array) to target/test specific flows.
See how it gets :slight_smile:

let deleteCards = false;
let flowNames;// = ['AddLogCards (Test)'];

async function run() {
    
  function genID(length) {
      let result = '';
      //const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
      const characters = 'abcdef0123456789';
      const charactersLength = characters.length;
      let counter = 0;
      while (counter < length) {
        result += characters.charAt(Math.floor(Math.random() * charactersLength));
        counter += 1;
      }
      return result;
  }
  function uuid() {
    return genID(8) + '-' + genID(4) + '-' + genID(4) + '-' + genID(4) + '-' + genID(12);
  }

  let afs = await Homey.flow.getAdvancedFlows();

  //afs = _.filter(afs, x=>x.name=='AddLogCards (Test)');
  afs = _.filter(afs, x=>!x.broken);
  if(flowNames) afs = _.filter(afs, x=>flowNames.indexOf(x.name)>-1);
  //afs = _.toArray(afs);

  for(let i=0;i<afs.length;i++) {
    let af = afs[i];
    
    for (const cardKey in af.cards) {
      if (Object.hasOwnProperty.call(af.cards, cardKey)) {
        const card = af.cards[cardKey];
        let logCard;
        if(!card.id) continue;
        if(deleteCards) {
          if(card.id.startsWith('homey:app:nl.nielsdeklerk.log:Input_group_log') && card.args.auto_created==true) {
            delete af.cards[cardKey];
            continue;
          }
          if(card.outputError) card.outputError = _.filter(card.outputError, x=>af.cards[x]);
          continue;
        }
        if(!card.id.startsWith('homey:app:nl.nielsdeklerk.log') && (!card.outputError || !card.outputError.length || !(logCard = _.find(card.outputError, x=> af.cards[x] && af.cards[x].id && af.cards[x].id.startsWith('homey:app:nl.nielsdeklerk.log:'))) )) {
          let uid = uuid();
          let newCard = {
            "ownerUri": "homey:app:nl.nielsdeklerk.log",
            "id": "homey:app:nl.nielsdeklerk.log:Input_group_log",
            "args": {
              "log": uid.substring(0,4) +": [[card::"+cardKey+"::error]]",
              "group": af.name,
              "severity": "3",
              "facility": "16",
              "auto_created":true
            },
            "type": "action",
            "x": card.x,
            "y": card.y-60
          };
          if(!card.outputError) card.outputError = [];          
          card.outputError.push(uid);
          let l = {};
          l[uid] = newCard;
          af.cards = _.merge( l, af.cards );
        }
      }
    }

    try {
      await Homey.flow.updateAdvancedFlow({id:af.id, advancedflow:af});
    } catch(ex) {}
  
  }
  return afs;
  //log(JSON.stringify(afs));
}
run();
1 Like

Hi Arie, sorry for the delay.

This is awesome!
I tested the script, but it doesn’t seem to change the flows yet.
I’ve PM’ed you the script Response.