{"id":454,"date":"2018-09-12T21:47:59","date_gmt":"2018-09-13T04:47:59","guid":{"rendered":"http:\/\/dragonwarz.net\/?p=454"},"modified":"2018-09-12T21:58:38","modified_gmt":"2018-09-13T04:58:38","slug":"testing-logging","status":"publish","type":"post","link":"https:\/\/dragonwarz.net\/?p=454","title":{"rendered":"Testing &#038; Logging"},"content":{"rendered":"\n<p>The next big thing I have to work on, is creating test programs I can run, to auto test my main programs.\u00a0 Considering all the functions and variables, this will probably take a bit of time to complete.<\/p>\n\n\n\n<p>Right now, I just manually test the program aspects that get changed, such as creating graphs when the graph functions change.\u00a0 This takes up a lot of time, and it&#8217;s only going to take more time as things progress further.\u00a0 However, I don&#8217;t want to rush my test code, since its going to be used a LOT!\u00a0 So I&#8217;ll set aside some time to plan it out a bit.\u00a0 What it does, how and why.<\/p>\n\n\n\n<p>In other news, I have taken a sensor on 2 trips, recording the whole time.\u00a0 For one, this gave me a 9MB Motion database file \ud83d\ude42\u00a0 This should help greatly in stress testing some of the graph features.\u00a0 Since motion can record up to 4 times per second, I need to find a way to filter that data, so it doesn&#8217;t have over 14,000 graph points in a hour&#8217;s time or less.\u00a0\u00a0<\/p>\n\n\n\n<p>I was thinking, if a data point is within 2 Seconds of the last one AND the difference is less than variance (say 0.1), skip it.\u00a0 I can also set the time and variance as variables at the top, so they can be changed. That should cut down on a lot of the noise, yet leave flexibility to adjust for whatever the need may be.\u00a0 Or I could just use one variable, so if it&#8217;s over X variance, it records for say 15 seconds, and resets that timmer if X variance happens again during the time.\u00a0 This would give a balance of fairly accurate recordings during an event, while recording nothing if its been still after 15 seconds.\u00a0\u00a0<\/p>\n\n\n\n<p>Come to think of it, I should probably add a config file on the sensor units themselves for variables that might be useful to change, depending on the situation.<\/p>\n\n\n\n<p>In other news, I found out there is a included module in Python for logging.\u00a0 I found it when I was going through PyCharm EDU lessons.\u00a0 So that should clean up some of my code and allow a more universal experience.\u00a0\u00a0<\/p>\n\n\n\n<p>I have already swapped the logger in my main py file, thanks to word replacement in Notepad++.\u00a0 PyCharm wouldn&#8217;t let me do it through refactoring though, because I was changing it from a function (message_print_log) to logger.info(), and PyCharm really didn&#8217;t want to change from no period thingy to something with a period in it.\u00a0\u00a0<\/p>\n\n\n\n<p>I do like the logger so far, it seems simple yet flexible.\u00a0 I expect to be fully using it, instead of my home grown one in a few days time with minimal effort.\u00a0 I do have to change how my logging window functions though&#8230; In fact I&#8217;ll probably just open up the log file itself in a text editor to &#8220;open&#8221; the log.\u00a0\u00a0<\/p>\n\n\n\n<p>Until next time.<\/p>\n\n\n\n<p>Edit: I forgot to mention, I have all my code on GitHub now!\u00a0 (All 4 programs since I started coding in June 2018).\u00a0\u00a0<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/chad-ermacora\">https:\/\/github.com\/chad-ermacora<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The next big thing I have to work on, is creating test programs I can run, to auto test my main programs.\u00a0 Considering all the functions and variables, this will probably take a bit of time to complete. Right now, &hellip;<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/dragonwarz.net\/?p=454\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-454","post","type-post","status-publish","format-standard","hentry","category-random"],"_links":{"self":[{"href":"https:\/\/dragonwarz.net\/index.php?rest_route=\/wp\/v2\/posts\/454","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dragonwarz.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dragonwarz.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dragonwarz.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dragonwarz.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=454"}],"version-history":[{"count":5,"href":"https:\/\/dragonwarz.net\/index.php?rest_route=\/wp\/v2\/posts\/454\/revisions"}],"predecessor-version":[{"id":471,"href":"https:\/\/dragonwarz.net\/index.php?rest_route=\/wp\/v2\/posts\/454\/revisions\/471"}],"wp:attachment":[{"href":"https:\/\/dragonwarz.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=454"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dragonwarz.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=454"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dragonwarz.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}