# Digi Dia FileLogger

**URL:** <https://forums.digi.com/t/digi-dia-filelogger/3241>\
**Category:** Python\
**Created:** [August 12, 2009, 12:58am UTC](https://forums.digi.com/t/digi-dia-filelogger/3241 "2009-08-12T00:58:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![waltr](https://avatars.discourse-cdn.com/v4/letter/w/898d66/32.png) [@waltr](https://forums.digi.com/u/waltr)\
**Post date:** [August 12, 2009, 12:58am UTC](https://forums.digi.com/t/digi-dia-filelogger/3241/1 "2009-08-12T00:58:12Z")

</div>

Have the Wi-9P starter kit. The hardware is working very well and I’ve gotten the demo python programs to run plus have added XBee nodes and the FileLogger to the configuration file.  
It took some playing to discover what the logger\_set in Dia wanted but did figure it out. But it can only ‘rewind’ or ‘fast forward’ to dump the latest or oldest recored states. The Developer’s Guide states:

The standard channel interaction calls (such as channel\_list) are supported in a logger’s Channel Database. Additionally, the following functions may be implemented:  
  
log\_rewind rewinds the channel database to represent the oldest known state  
25

  
log\_seek sets the channel database to represent the known state closest to the given timestamp  
  
log\_time returns the time the state of the channel database represents  
  
log\_event\_iterator returns a list of events occurring between two times  
  
\*log\_next Advance the channel database one event in time  
  
\*log\_prev Step the channel database back one event in time

- Not available in the current File Logger.

But the Seek, Time and Event commands are not available making the logger not very useful. Digging into the code I found in channel\_database.py:

```
## Functions Not implemented:
def log_next(self):
    """Not implemented"""
    raise ChannelDatabaseFunctionNotImplemented, "Not implemented"

def log_prev(self):
    """Not implemented"""
    raise ChannelDatabaseFunctionNotImplemented, "Not implemented"

def log_rewind(self):
    """Not implemented"""
    raise ChannelDatabaseFunctionNotImplemented, "Not implemented"

def log_seek(self, timestamp):
    """Not implemented"""
    raise ChannelDatabaseFunctionNotImplemented, "Not implemented"

def log_time(self):
    """Not implemented"""
    raise ChannelDatabaseFunctionNotImplemented, "Not implemented"

def log_event_iterator(self, timestamp_from, timestamp_to):
    """Not implemented"""
    raise ChannelDatabaseFunctionNotImplemented, "Not implemented"

```

This is an incomplete piece of code. Will this code be completed and released anytime soon?

---

<div class="post-metadata">

**Author:** ![blalor](https://avatars.discourse-cdn.com/v4/letter/b/ee59a6/32.png) [@blalor](https://forums.digi.com/u/blalor)\
**Post date:** [August 12, 2009, 1:08am UTC](https://forums.digi.com/t/digi-dia-filelogger/3241/2 "2009-08-12T01:08:12Z")

</div>

You’re looking a little too high up in the object inheritance tree. file\_logger\_context.py contains a concrete implementation of ChannelDatabaseInterface. It also fails to implement several of the methods, but log\_event\_iterator() seems to be where the action’s at.

---

<div class="post-metadata">

**Author:** ![waltr](https://avatars.discourse-cdn.com/v4/letter/w/898d66/32.png) [@waltr](https://forums.digi.com/u/waltr)\
**Post date:** [August 13, 2009, 1:33am UTC](https://forums.digi.com/t/digi-dia-filelogger/3241/3 "2009-08-13T01:33:43Z")

</div>

Ok, thanks for some direction.  
I’m looking and found the log\_event\_iterator def. I’m ok programing in assembler and C but do get a little lost with C++ classes, etc. I think it’ll be some time before I can work on python code at this depth.  
This is why I am a bit disappointed with the incompleteness of iDigi Dia as it is toted as being an easy way to implement and customize a ZigBee network, all that is needed to write is a config file (.yml) and device drivers not recoding deep inside the CLI code modules.

---

<div class="post-metadata">

**Author:** ![blalor](https://avatars.discourse-cdn.com/v4/letter/b/ee59a6/32.png) [@blalor](https://forums.digi.com/u/blalor)\
**Post date:** [August 13, 2009, 9:54am UTC](https://forums.digi.com/t/digi-dia-filelogger/3241/4 "2009-08-13T09:54:22Z")

</div>

Why do you think that Dia requires “recoding deep inside the CLI code modules”, and that Dia is incomplete? The documentation could certainly be better, and I’ve found a few bugs, but by and large I find Dia to be quite complete. There’s no need to modify the core code. And the CLI interface is helpful for troubleshooting and viewing your configuration, but it’s mainly a troubleshooting tool.

---

<div class="post-metadata">

**Author:** ![waltr](https://avatars.discourse-cdn.com/v4/letter/w/898d66/32.png) [@waltr](https://forums.digi.com/u/waltr)\
**Post date:** [August 13, 2009, 12:54pm UTC](https://forums.digi.com/t/digi-dia-filelogger/3241/5 "2009-08-13T12:54:07Z")

</div>

Well as the example that started this thread:  
With the CLI logger in its current state of coding one can only Rewind to the oldest entry or fast\_forward to the latest entry. There isn’t any way to ‘step through’ the log entries. Inside the code there are ‘next’, ‘back’ and ‘seek’ code but none are available at the CLI.

Maybe what you are trying to tell me is that these code pieces are only for use within code I write!

I do agree with the documentation, its pretty bad. Even more so is the fragmentation of information on the pieces used, Dia, Wi9P OS, XBee modules, etc. It also seems that one is expected to dig into lots of code to find general specs.

Anyway, thanks for the help.

---

<div class="post-metadata">

**Author:** ![blalor](https://avatars.discourse-cdn.com/v4/letter/b/ee59a6/32.png) [@blalor](https://forums.digi.com/u/blalor)\
**Post date:** [August 15, 2009, 11:02am UTC](https://forums.digi.com/t/digi-dia-filelogger/3241/6 "2009-08-15T11:02:14Z")

</div>

Actually, you _can_ step through the log entries, using the event iterator. It takes a range of timestamps. It requires a little more thought than prev/next, but it is quite useful.

---

<div class="post-metadata">

**Author:** ![waltr](https://avatars.discourse-cdn.com/v4/letter/w/898d66/32.png) [@waltr](https://forums.digi.com/u/waltr)\
**Post date:** [August 16, 2009, 8:24pm UTC](https://forums.digi.com/t/digi-dia-filelogger/3241/7 "2009-08-16T20:24:38Z")

</div>

Is this event iterator available from the Dia CLI or just from code I would need to write?

---

<div class="post-metadata">

**Author:** ![blalor](https://avatars.discourse-cdn.com/v4/letter/b/ee59a6/32.png) [@blalor](https://forums.digi.com/u/blalor)\
**Post date:** [August 16, 2009, 8:35pm UTC](https://forums.digi.com/t/digi-dia-filelogger/3241/8 "2009-08-16T20:35:51Z")

</div>

It’s the log\_event\_iterator method of the ChannelDatabaseInterface class. You’d have to write code to call that method.
