Commit abc1f3ac authored by Gergo Ujhelyi's avatar Gergo Ujhelyi
Browse files

add first methods to log into file in loggerpluginmanager and


legacylogger
Signed-off-by: Gergo Ujhelyi's avatarGergoUjhelyi <ujhelyi.gergo@ericsson.com>
parent 3a4d9a7b
......@@ -14,4 +14,9 @@ package org.eclipse.titan.runtime.core;
*/
public interface ILoggerPlugin {
void log(final TitanLoggerApi.TitanLogEvent event, final boolean log_buffered, final boolean separate_file, final boolean use_emergency_mask);
void set_file_name(final String new_filename_skeleton, final boolean from_config);
void set_append_file(final boolean new_append_file);
boolean set_file_size(final int p_size);
boolean set_file_number(final int p_number);
boolean set_disk_full_action(final TtcnLogger.disk_full_action_t p_disk_full_action);
}
......@@ -66,6 +66,16 @@ public class LegacyLogger implements ILoggerPlugin {
* This function represents the entry point for the legacy style logger plugin.
* (still embedded in this generic class while transitioning the design)
* */
private String filename_skeleton_;
private TtcnLogger.disk_full_action_t disk_full_action_;
private boolean skeleton_given_;
private boolean append_file_;
private boolean is_disk_full_;
private String current_filename_;
private int logfile_size_;
private int logfile_number_;
public void log(final TitanLoggerApi.TitanLogEvent event, final boolean log_buffered, final boolean separate_file, final boolean use_emergency_mask) {
if (separate_file) {
//FIXME implement
......@@ -86,6 +96,33 @@ public class LegacyLogger implements ILoggerPlugin {
}
}
public void set_file_name(String new_filename_skeleton, boolean from_config) {
filename_skeleton_ = "";
filename_skeleton_ = new_filename_skeleton;
if (from_config) {
skeleton_given_ = true;
}
}
public void set_append_file(boolean new_append_file) {
append_file_ = new_append_file;
}
public boolean set_file_size(int p_size) {
logfile_size_ = p_size;
return true;
}
public boolean set_file_number(int p_number) {
logfile_number_ = p_number;
return true;
}
public boolean set_disk_full_action(TtcnLogger.disk_full_action_t p_disk_full_action) {
disk_full_action_ = p_disk_full_action;
return true;
}
/**
* The log_console function from the legacy logger.
*
......
......@@ -59,6 +59,7 @@ import org.eclipse.titan.runtime.core.TitanLoggerApi.TitanLogEvent_sourceInfo__l
import org.eclipse.titan.runtime.core.TitanVerdictType.VerdictTypeEnum;
import org.eclipse.titan.runtime.core.TtcnLogger.Severity;
import org.eclipse.titan.runtime.core.TtcnLogger.TTCN_Location;
import org.eclipse.titan.runtime.core.TtcnLogger.component_id_t;
import org.eclipse.titan.runtime.core.TtcnLogger.emergency_logging_behaviour_t;
import org.eclipse.titan.runtime.core.TtcnLogger.extcommand_t;
......@@ -189,6 +190,58 @@ public class LoggerPluginManager {
}
}
public void set_file_name(final String new_filename_skeleton, boolean from_config) {
for (int i = 0; i < plugins_.size(); i++) {
plugins_.get(i).set_file_name(new_filename_skeleton, from_config);
}
}
public void set_append_file(boolean new_append_file) {
for (int i = 0; i < plugins_.size(); i++) {
plugins_.get(i).set_append_file(new_append_file);
}
}
public boolean set_file_size(final component_id_t comp, int p_size) {
boolean ret_val = false;
for (int i = 0; i < plugins_.size(); i++) {
if (plugins_.get(i).set_file_size(p_size)) {
ret_val = true;
}
}
return ret_val;
}
public boolean set_file_number(final component_id_t cmpt, int p_number) {
boolean ret_val = false;
for (int i = 0; i < plugins_.size(); i++) {
if (plugins_.get(i).set_file_number(p_number)) {
ret_val = true;
}
}
return ret_val;
}
public boolean set_disk_full_action(final component_id_t comp, TtcnLogger.disk_full_action_t p_disk_full_action) {
boolean ret_val = false;
for (int i = 0; i < plugins_.size(); i++) {
if (plugins_.get(i).set_disk_full_action(p_disk_full_action)) {
ret_val = true;
}
}
return ret_val;
}
public void open_file() {
//FIXME: implement
}
public void close_file() {
//FIXME: implement
}
public void begin_event(final Severity msg_severity) {
final log_event_struct temp = new log_event_struct();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment