Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Roku Guru

roSystemLog documentation incomplete

There is example code here
which copied simply causes a crash;
Current Function:
119:                  ' Handle the roSystemLogEvents:'
120:                  i = msg.GetInfo()
121:                  If i.LogType = "http.error" or i.LogType = "http.connect"
122:                      If i.LogType = "http.error"
123:                          metrics.errorCount = metrics.errorCount + 1
124:                          print "http error: "; i.HttpCode; "URL: ";i.Url
125:                      End If
126:                      url = i.OrigUrl
127:*                     If (not httpIpAddrs.DoesExist(url)) Then
128:                          httpIpAddrs[url] = CeateObject("roAssociativeArray")
129:                      End If
130:                      httpIpAddrs[url].AddReplace(i.TargetIp,"")
131:                  Else If i.LogType = "bandwidth.minute"
'Dot' Operator attempted with invalid BrightScript Component or interface reference. (runtime error &hec) in pkg:/source/Main.brs(127)
127:                     If (not httpIpAddrs.DoesExist(url)) Then
#1  Function appeventloop(app As Dynamic) As Dynamic
   file/line: pkg:/source/Main.brs(127)
#0  Function main(args As Dynamic) As Dynamic
   file/line: pkg:/source/Main.brs(51)
Local Variables:

Obviously the 'httpIpAddrs' object needs to be initialized, but what is the point of this object, is it explained elsewhere?
0 Kudos
Roku Guru

Re: roSystemLog documentation incomplete

It looks like they're just trying to maintain a list of ip addresses for their own logging purposes, but as you noted they have not initialized the object. You don't need that part; you can do whatever you want with the log data. Obviously, their code wasn't tested (I don't think the compiler will like CeateObject either).
0 Kudos