mirror of
				https://github.com/iiab/iiab.git
				synced 2025-03-09 15:40:17 +00:00 
			
		
		
		
	clean up logging
This commit is contained in:
		
							parent
							
								
									163c65241f
								
							
						
					
					
						commit
						6ed76a9491
					
				
					 2 changed files with 9 additions and 5 deletions
				
			
		| 
						 | 
					@ -39,7 +39,11 @@ doc_root = get_iiab_env("WWWROOT")
 | 
				
			||||||
fully_qualified_domain_name = get_iiab_env("FQDN")
 | 
					fully_qualified_domain_name = get_iiab_env("FQDN")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
loggingLevel = "DEBUG"
 | 
					loggingLevel = "ERROR"
 | 
				
			||||||
 | 
					if len(sys.argv) > 1:
 | 
				
			||||||
 | 
					   if sys.argv[1] == '-l':
 | 
				
			||||||
 | 
					      loggingLevel = "DEBUG"
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
# set up some logging -- selectable for diagnostics
 | 
					# set up some logging -- selectable for diagnostics
 | 
				
			||||||
logging.basicConfig(filename='/var/log/apache2/portal.log',format='%(asctime)s.%(msecs)03d:%(name)s:%(message)s', datefmt='%M:%S',level=loggingLevel)
 | 
					logging.basicConfig(filename='/var/log/apache2/portal.log',format='%(asctime)s.%(msecs)03d:%(name)s:%(message)s', datefmt='%M:%S',level=loggingLevel)
 | 
				
			||||||
logger = logging.getLogger('/var/log/apache2/portal.log')
 | 
					logger = logging.getLogger('/var/log/apache2/portal.log')
 | 
				
			||||||
| 
						 | 
					@ -146,7 +150,7 @@ def set_lasttimestamp(ip):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#  ###################  Action routines based on OS  ################3
 | 
					#  ###################  Action routines based on OS  ################3
 | 
				
			||||||
def microsoft(environ,start_response):
 | 
					def microsoft(environ,start_response):
 | 
				
			||||||
    print('in microsoft')
 | 
					    logger.debug('in microsoft')
 | 
				
			||||||
    # firefox -- seems both mac and Windows use it
 | 
					    # firefox -- seems both mac and Windows use it
 | 
				
			||||||
    agent = environ.get('HTTP_USER_AGENT','default_agent')
 | 
					    agent = environ.get('HTTP_USER_AGENT','default_agent')
 | 
				
			||||||
    if agent.startswith('Mozilla'):
 | 
					    if agent.startswith('Mozilla'):
 | 
				
			||||||
| 
						 | 
					@ -242,7 +246,7 @@ def android_https(environ, start_response):
 | 
				
			||||||
    return [response_body]
 | 
					    return [response_body]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def mac_splash(environ,start_response):
 | 
					def mac_splash(environ,start_response):
 | 
				
			||||||
    print('in mac_splash')
 | 
					    logger.debug('in mac_splash')
 | 
				
			||||||
    logger.debug("in function mac_splash")
 | 
					    logger.debug("in function mac_splash")
 | 
				
			||||||
    en_txt={ 'message': "Click on the button to go to the IIAB home page",\
 | 
					    en_txt={ 'message': "Click on the button to go to the IIAB home page",\
 | 
				
			||||||
            'btn1': "GO TO IIAB HOME PAGE",'success_token': 'Success',
 | 
					            'btn1': "GO TO IIAB HOME PAGE",'success_token': 'Success',
 | 
				
			||||||
| 
						 | 
					@ -266,7 +270,7 @@ def mac_splash(environ,start_response):
 | 
				
			||||||
    return [response_body]
 | 
					    return [response_body]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def macintosh(environ, start_response):
 | 
					def macintosh(environ, start_response):
 | 
				
			||||||
    print('in macintosh')
 | 
					    logger.debug('in macintosh')
 | 
				
			||||||
    global ip
 | 
					    global ip
 | 
				
			||||||
    logger.debug("in function mcintosh")
 | 
					    logger.debug("in function mcintosh")
 | 
				
			||||||
    #print >> sys.stderr , "Geo Print to stderr" + environ['HTTP_HOST']
 | 
					    #print >> sys.stderr , "Geo Print to stderr" + environ['HTTP_HOST']
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
#!/bin/bash -x
 | 
					#!/bin/bash -x
 | 
				
			||||||
awk '{print("address=/" $1 "/ 172.18.96.1")}' /opt/iiab/captiveportal/checkurls > /etc/dnsmasq.d/capture
 | 
					awk '{print("address=/" $1 "/172.18.96.1")}' /opt/iiab/captiveportal/checkurls > /etc/dnsmasq.d/capture
 | 
				
			||||||
echo "#following tells windows 7 that captive portal is active" >>/etc/dnsmasq.d/capture
 | 
					echo "#following tells windows 7 that captive portal is active" >>/etc/dnsmasq.d/capture
 | 
				
			||||||
echo "address=/dns.msftncsi.com/131.107.255.255" >> /etc/dnsmasq.d/capture
 | 
					echo "address=/dns.msftncsi.com/131.107.255.255" >> /etc/dnsmasq.d/capture
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue