All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.znerd.util.log.InMemoryLimb Maven / Gradle / Ivy

Go to download

Set of utility classes (with associated unit tests) used by other znerd.org-projects

The newest version!
// See the COPYRIGHT file for copyright and license information
package org.znerd.util.log;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class InMemoryLimb extends Limb {
    protected void logImpl(LogLevel level, String message, Throwable exception) {
        _entries.add(new Entry(level, message, exception));
    }

    private List _entries = new ArrayList();

    public static class Entry {
        Entry(LogLevel level, String message, Throwable exception) {
            _timestamp = System.currentTimeMillis();
            _level = level;
            _message = message;
            _exception = exception;
        }

        private long _timestamp;
        private LogLevel _level;
        private String _message;
        private Throwable _exception;

        public long getTimestamp() {
            return _timestamp;
        }
        
        public LogLevel getLevel() {
            return _level;
        }

        public String getMessage() {
            return _message;
        }

        public Throwable getException() {
            return _exception;
        }
    }
    
    public List getEntries() {
        return Collections.unmodifiableList(_entries);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy