diff --git a/net_services_protocols/logger_client.anubis b/net_services_protocols/logger_client.anubis index f4884a8..3f173f5 100644 --- a/net_services_protocols/logger_client.anubis +++ b/net_services_protocols/logger_client.anubis @@ -62,8 +62,8 @@ public define One forget(add_string(register_msg, "LOG_NAME", logger_name)); forget(add_int32(register_msg, "FORMAT_SIZE", truncate_to_Word32(format_size))); forget(add_string(register_msg, "FILE_NAME", file_name)); - forget( add_int32(register_msg, "FILE_LEVEL", truncate_to_Word32(get_log_level_value(file_level)))); - forget( add_int32(register_msg, "CONS_LEVEL", truncate_to_Word32(get_log_level_value(cons_level)))); + forget( add_int32(register_msg, "FILE_LEVEL", truncate_to_Word32(to_Int(file_level)))); + forget( add_int32(register_msg, "CONS_LEVEL", truncate_to_Word32(to_Int(cons_level)))); local_net_logger("127.0.0.1", register_msg) . @@ -90,7 +90,7 @@ public define One String logger_name, String log_string )= - local_net_logger("127.0.0.1", create_log_msg(uid, logger_name, log_string, get_log_level_value(level))) + local_net_logger("127.0.0.1", create_log_msg(uid, logger_name, log_string, to_Int(level))) . public define One diff --git a/web/plugin/plugin.anubis b/web/plugin/plugin.anubis index 4b5b4d0..3594d36 100644 --- a/web/plugin/plugin.anubis +++ b/web/plugin/plugin.anubis @@ -35,54 +35,85 @@ public type WEB_Plugin: public define Maybe(WEB_Plugin) load_plugin ( - String file_name - ) - = + String file_name, + (LogLevel, String) -> One logger + )= if (LoadAdm(WEB_Plugin))load_adm(file_name) is { - file_not_found then print("File '"+file_name+"' not found.\n\n");failure, - read_error then print("Error reading file '"+file_name+"'.\n\n");failure, - timeout then print("Timeout when loading '"+file_name+"'.\n\n");failure, - file_damaged then print("File '"+file_name+"' is damaged.\n\n");failure, - bad_version(expected,found) then print("Secondary module '"+file_name+"' doesn't have the same\n"+ + file_not_found then logger(logError, "File '"+file_name+"' not found.\n\n");failure, + read_error then logger(logError, "Error reading file '"+file_name+"'.\n\n");failure, + timeout then logger(logError, "Timeout when loading '"+file_name+"'.\n\n");failure, + file_damaged then logger(logError, "File '"+file_name+"' is damaged.\n\n");failure, + bad_version(expected,found) then logger(logError, "Secondary module '"+file_name+"' doesn't have the same\n"+ " version ("+found+") as primary module ("+expected+").\n\n");failure, - wrong_type(expected,found) then print("Secondary module '"+file_name+"' has different type as expected by primary module\n");failure, - ok(ptah_plugin) then println("ptah plugin: APP ["+ptah_plugin.app_name+"] SPACE ["+ptah_plugin.space_name+"] version: "+ptah_plugin.version+" date: "+ptah_plugin.date+" loaded ");success(ptah_plugin) - }. - + wrong_type(expected,found) then logger(logError, "Secondary module '"+file_name+"' has different type as expected by primary module\n");failure, + ok(web_plugin) then logger(logInfo, "web plugin loaded: APP ["+web_plugin.app_name+"] SPACE ["+web_plugin.space_name+"] version: "+web_plugin.version+" date: "+web_plugin.date+" loaded ");success(web_plugin) + } +. + +public define Maybe(WEB_Plugin) + load_plugin + ( + String file_name + )= + load_plugin(file_name, (LogLevel lvl, String string) |-> println(to_String(lvl)+" "+string)) +. + + public define List(WEB_Plugin) all_plugins ( - String directory, //directory where search the plugin file below - String plugin_file_mask //mask for loading plugin like "my_app_plugin_*.adm" - ) - = + String directory, //directory where search the plugin file below + String plugin_file_mask, //mask for loading plugin like "my_app_plugin_*.adm" + (LogLevel, String) -> One logger // + )= with files = directory_list(directory, plugin_file_mask), - map_select((String file_name) |-> load_plugin(directory+file_name), files) - //merge_sort(all_list, migration_less) + map_select( + (String file_name) |-> + load_plugin(directory+file_name, logger) + , + files + ) +. + +public define List(WEB_Plugin) + all_plugins + ( + String directory, //directory where search the plugin file below + String plugin_file_mask //mask for loading plugin like "my_app_plugin_*.adm" + )= + all_plugins(directory, plugin_file_mask, (LogLevel lvl, String string) |-> println(to_String(lvl)+" "+string)) . public define Maybe(WEB_Plugin) get_WEB_Plugin ( - List(WEB_Plugin) plugins, - String _app, - String _space + List(WEB_Plugin) plugins, + String _app, + String _space, + (LogLevel, String) -> One logger )= if plugins is { - [] then println("get_WEB_Plugin for app ["+_app+"] space ["+_space+"] NOT FOUND");failure, + [] then logger(logError, "get_WEB_Plugin for app ["+_app+"] space ["+_space+"] NOT FOUND");failure, [h . t] then if h.app_name = _app & h.space_name = _space then //println("get_WEB_Plugin for app ["+_app+"] space ["+_space+"] OK"); success(h) else - get_WEB_Plugin(t, _app, _space) + get_WEB_Plugin(t, _app, _space, logger) } . - - +public define Maybe(WEB_Plugin) + get_WEB_Plugin + ( + List(WEB_Plugin) plugins, + String _app, + String _space + )= + get_WEB_Plugin(plugins, _app, _space, (LogLevel lvl, String string) |-> println(to_String(lvl)+" "+string)) +. public define World_Left_Menu get_left_menu_from_plugins -- libgit2 0.21.4