; ; @ANO_SCRIPT_NAME log_handler ; @ANO_SCRIPT_VERSION 0.0.1 ; @ANO_SCRIPT_DESCRIPTION Simple error handler ; ; @ANO_FLAGS_USE_PROTOS [ ] ; @ANO_FLAGS_VAR_NAME_SUBS [ ] ; @ANO_FLAGS_VAR_WARN_UNUSED [ ] ; ; Copyright (c) 2016-2026, Jani Salonen ; All rights reserved. ; ; Enable function prototype checking ; proto print_error(class, code, level, errno, cmd, node) main [exit: 0] { ; Log handlers need no initialization, just try to call nonexistent ; function to cause an error. ; nonexistent() } loghandler info { print "There is something worth mention, message details:" . "\n\n" _code = get_last_error_code _level = get_last_error_level _errno = get_last_error_errno _ano_cmd = get_last_error_command _ano_node = get_last_error_node &print_error (\ class: "Info", \ code: _code, \ level: _level, \ errno: _errno, \ cmd: _ano_cmd, \ node: _ano_node) } loghandler warn { print "Something did not work as expected, warning details:" . "\n\n" _code = get_last_error_code _level = get_last_error_level _errno = get_last_error_errno _ano_cmd = get_last_error_command _ano_node = get_last_error_node &print_error (\ class: "Warning", \ code: _code, \ level: _level, \ errno: _errno, \ cmd: _ano_cmd, \ node: _ano_node) } loghandler error { print "Something went totally wrong, error details:" . "\n\n" _code = get_last_error_code _level = get_last_error_level _errno = get_last_error_errno &print_error (\ class: "Error", \ code: _code, \ level: _level, \ errno: _errno, \ cmd: "N/A", \ node: "N/A") } function print_error (_class, _code, _level, _errno, _cmd, _node) { print "Error class: " . _class . "\n" print "Error code: " . _code . "\n" print "Error level: " . _level . "\n" print "Error errno: " . _errno . "\n" print "Command: " . _cmd . "\n" print "Node: " . _node . "\n" }