This module allows you log errors, warnings, and info to syslog, stdout or a file. The verbosity level and/or filter allow you to customize the output.
void separator ()
output a simple line separator
Example in c++ :
ALLoggerProxy* log; try { log = new ALLoggerProxy(); log->separator(); } catch(const ALError&) { std::cout << "error during initialisation" << std::endl; } delete log;
Example in Python :
# Print a separator log = ALProxy("ALLogger", "127.0.0.1", 9559) log.separator()
void fatal (const string& moduleName, const string& message)
Log a fatal error.
Name of the module.
Log Message.
Example in Python :
# Print a fatal message log = ALProxy("ALLogger", "127.0.0.1", 9559) log.fatal("moduleName", "message")
void error (const string& moduleName, const string& message)
Log an error.
Name of the module.
Log Message.
Example in Python :
# Print an error message log = ALProxy("ALLogger", "127.0.0.1", 9559) log.error("moduleName", "message")
void warn (const string& moduleName, const string& message)
Log a warning.
Name of the module.
Log Message.
Example in Python :
# Print a warning message log = ALProxy("ALLogger", "127.0.0.1", 9559) log.warn("moduleName", "message")
void info (const string& moduleName, const string& message)
Log a info message.
Name of the module.
Log Message.
Example in Python :
# Print an info message log = ALProxy("ALLogger", "127.0.0.1", 9559) log.info("moduleName", "message")
void lowInfo (const string& moduleName, const string& message)
DEPRECIATED: Log a low priority information message. Use info instead.
Name of the module.
Log Message.
void debug (const string& moduleName, const string& message)
Log a debug message.
Name of the module.
Log Message.
Example in Python :
# Print an debug message log = ALProxy("ALLogger", "127.0.0.1", 9559) log.debug("moduleName", "message")
void lowDebug (const string& moduleName, const string& message)
DEPRECIATED: Log a low priority debug message. Use debug instead.
Name of the module.
Log Message.
void setVerbosity (const string& verbosity)
set verbosity: debug, info, warning, error, fatal, silent. Default is info
verbosity value
Example in Python :
# Set the verbosity to debug log = ALProxy("ALLogger", "127.0.0.1", 9559) log.setVerbosity("debug") log.debug("moduleName", "message")
Example in Python :
# Set the verbosity to warning log = ALProxy("ALLogger", "127.0.0.1", 9559) log.setVerbosity("warning") # This message will not be seen in the log log.info("moduleName", "info message, not seen") # But this one will be log.warn("moduleName", "warning message")
void setFilter (const string& filter)
Creates a filter. Only messages containing the string will be logged. Use an empty string to remove the filter.
The string that defines the filter.
Example in Python :
# Filter messages log = ALProxy("ALLogger", "127.0.0.1", 9559) log.setFilter("rain") # This message will be seen: log.fatal("moduleName", "It is raining") # But this one will not: log.fatal("moduleName", "It is sunny") # Remove the filter log.setFilter("")
void logInFile (const string& fileName)
Allows the logger to store logs in a file. Warning: this is not recomended on Nao.
The fileName to use. Relative to the user naoqi folder.
Example in Python :
# Start logging to file. # Note: it is not recommended to log to file on Nao. log = ALProxy("ALLogger", "127.0.0.1", 9559) log.logInFile("fileName.txt")
void logInStd ()
Allows the logger to output logs to the standard output.
Example in Python :
# Send output to console log = ALProxy("ALLogger", "127.0.0.1", 9559) log.logInStd()
void logInSys ()
Allows the logger to output logs to the system log. (Linux only)
Example in Python :
# Send output to syslog, on platforms that support this log = ALProxy("ALLogger", "127.0.0.1", 9559) log.logInSys()
void logInForwarder (const string& inputAddress)
Publish logs to a Log Forwarder. Pass an empty string in order to use the default value: "tcp://localhost:50998"
Desired input ZMQ address of the Log Forwarder.
Example in Python :
log = ALProxy("ALLogger", "127.0.0.1", 9559) log.logInForwarder("tcp://localhost:50998")
void removeHandler (const string& id)
Unsubscribe specified id from connection list.
Id used to register the handler.
Example in Python :
log = ALProxy("ALLogger", "127.0.0.1", 9559) log.removeConnection("MyLogger")
string version ()
Returns the version of the module.
A string containing the version of the module.
AL::ALValue getMethodHelp (const string& methodName)
Retrieves a method's description.
The name of the method.
A structure containing the method's description.
AL::ALValue getModuleHelp ()
Retrieves the module's description.
A structure describing the module.
string getUsage (const string& name)
Gets the method usage string. This summarise how to use the method.
The name of the method.
A string that summarises the usage of the method.
Example in c++ :
try { getParentBroker()->getLoggerProxy()->info("MyModule", "This is an info message"); } catch(const ALError &e) { std::cout << "Error when using ALLogger: " + e.toString() << std::endl; }
Example in Python :
import naoqi from naoqi import ALProxy log = ALProxy("ALLogger", "127.0.0.1", 9559) log.info("MyModule", "This is a info message");