Tag Archive for logger

Python log setup

def setupLogger(self, log_dir):
                if not isdir(log_dir):
                        os.mkdir(log_dir)

                # create logger
                log_file = join(log_dir, time.strftime('%Y_%m_%d') + '.log')
                logger = logging.getLogger(log_file)
                logger.setLevel(logging.INFO)

                # create console handler and set level to debug
                ch = logging.FileHandler(log_file)
                ch.setLevel(logging.INFO)

                # create formatter
                formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")

                # add formatter to ch
                ch.setFormatter(formatter)

                # add ch to logger
                logger.addHandler(ch)

                return logger

source

ThunderBoltAS3 logger

import org.osflash.thunderbolt.Logger;

var myNumber: int = 5;
var myString2: String = "Lorem ipsum";
Logger.error ("Logging two objects: A number typed as int and a string", myNumber, myString);

source

Poor man’s keylogger

tcpdump -A -s 0 port 80 2>&1 >> /tmp/80.out &

source