simple log viewer

This commit is contained in:
2017-02-26 18:37:09 +01:00
parent ece471f167
commit fe957213d7
3 changed files with 130 additions and 10 deletions

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Project SYSTEM "Project-5.1.dtd">
<!-- eric project file for project revpipyload -->
<!-- Saved: 2017-02-16, 07:47:17 -->
<!-- Saved: 2017-02-26, 18:35:15 -->
<!-- Copyright (C) 2017 Sven Sager, akira@narux.de -->
<Project version="5.1">
<Language>en_US</Language>
@@ -9,7 +9,7 @@
<ProgLanguage mixed="0">Python3</ProgLanguage>
<ProjectType>Console</ProjectType>
<Description>Dieser Loader wird über das Init-System geladen und führt das angegebene Pythonprogramm aus. Es ist für den RevolutionPi gedacht um automatisch das SPS-Programm zu starten.</Description>
<Version>0.1.0</Version>
<Version>0.2.0</Version>
<Author>Sven Sager</Author>
<Email>akira@narux.de</Email>
<Eol index="-1"/>
@@ -28,7 +28,110 @@
<Other>MANIFEST.in</Other>
</Others>
<Vcs>
<VcsType>None</VcsType>
<VcsType>Mercurial</VcsType>
<VcsOptions>
<dict>
<key>
<string>add</string>
</key>
<value>
<list>
<string></string>
</list>
</value>
<key>
<string>checkout</string>
</key>
<value>
<list>
<string></string>
</list>
</value>
<key>
<string>commit</string>
</key>
<value>
<list>
<string></string>
</list>
</value>
<key>
<string>diff</string>
</key>
<value>
<list>
<string></string>
</list>
</value>
<key>
<string>export</string>
</key>
<value>
<list>
<string></string>
</list>
</value>
<key>
<string>global</string>
</key>
<value>
<list>
<string></string>
</list>
</value>
<key>
<string>history</string>
</key>
<value>
<list>
<string></string>
</list>
</value>
<key>
<string>log</string>
</key>
<value>
<list>
<string></string>
</list>
</value>
<key>
<string>remove</string>
</key>
<value>
<list>
<string></string>
</list>
</value>
<key>
<string>status</string>
</key>
<value>
<list>
<string></string>
</list>
</value>
<key>
<string>tag</string>
</key>
<value>
<list>
<string></string>
</list>
</value>
<key>
<string>update</string>
</key>
<value>
<list>
<string></string>
</list>
</value>
</dict>
</VcsOptions>
<VcsOtherData>
<dict/>
</VcsOtherData>
</Vcs>
<FiletypeAssociations>
<FiletypeAssociation pattern="*.idl" type="INTERFACES"/>

View File

@@ -1,6 +1,10 @@
#!/usr/bin/python3
#
# (c) Sven Sager, License: GPLv3
# RevPiPyLoad
# Version: 0.2.0
#
# Webpage: https://revpimodio.org/
# (c) Sven Sager, License: LGPLv3
#
# -*- coding: utf-8 -*-
import proginit
@@ -170,6 +174,8 @@ class RevPiPyLoad(proginit.ProgInit):
)
self.xsrv.register_introspection_functions()
self.xsrv.register_function(self.xml_getapplog, "get_applog")
self.xsrv.register_function(self.xml_getplclog, "get_plclog")
self.xsrv.register_function(self.xml_plcexitcode, "plcexitcode")
self.xsrv.register_function(self.xml_plcrestart, "plcrestart")
self.xsrv.register_function(self.xml_plcrunning, "plcrunning")
@@ -230,12 +236,22 @@ class RevPiPyLoad(proginit.ProgInit):
self.tpe.shutdown()
self.xsrv.server_close()
def xml_getapplog(self):
self.logger.debug("xmlrpc call getapplog")
fh = open("/var/log/revpipyloadapp")
return fh.read()
def xml_getplclog(self):
self.logger.debug("xmlrpc call getplclog")
fh = open("/var/log/revpipyload")
return fh.read()
def xml_plcexitcode(self):
self.logger.debug("xmlrpc get plcexitcode")
self.logger.debug("xmlrpc call plcexitcode")
return -1 if self.plc.is_alive() else self.plc.exitcode
def xml_plcrestart(self):
self.logger.debug("xmlrpc get plcrestart")
self.logger.debug("xmlrpc call plcrestart")
self.plc.stop()
self.plc.join()
exitcode = self.plc.exitcode
@@ -250,10 +266,11 @@ class RevPiPyLoad(proginit.ProgInit):
return (exitcode, self.plc.exitcode)
def xml_plcrunning(self):
self.logger.debug("xmlrpc get plcrunning")
self.logger.debug("xmlrpc call plcrunning")
return self.plc.is_alive()
def xml_plcstart(self):
self.logger.debug("xmlrpc call plcstart")
if self.plc.is_alive():
return -1
else:
@@ -268,13 +285,13 @@ class RevPiPyLoad(proginit.ProgInit):
return self.plc.exitcode
def xml_plcstop(self):
self.logger.debug("xmlrpc get plcstop")
self.logger.debug("xmlrpc call plcstop")
self.plc.stop()
self.plc.join()
return self.plc.exitcode
def xml_reload(self):
self.logger.info("xmlrpc reload configuration")
self.logger.debug("xmlrpc call reload")
self.evt_loadconfig.set()

View File

@@ -27,7 +27,7 @@ setup(
license="LGPLv3",
name="revpipyload",
version="0.1.0",
version="0.2.0",
scripts=["data/revpipyload"],