Skip to content

Instantly share code, notes, and snippets.

@isicju
Created March 8, 2024 18:51
Show Gist options
  • Save isicju/551a3a5332ba5e671d3c65866ad7cd67 to your computer and use it in GitHub Desktop.
Save isicju/551a3a5332ba5e671d3c65866ad7cd67 to your computer and use it in GitHub Desktop.
Логирование
//Допустим у вас есть интерфейс
interface Logger{
void info(String normalMessage);
void error(String errorMessage);
}
// Есть его иплементация
NormalLogger implements Logger{
void info(String normalMessage){
System.out.println("printng normal message");
}
void error(String normalMessage){
System.out.println("printng error message");
}
}
// Использование первых двух:
public static void main(String[] args){
Logger averageLogger = new NormalLogger();
averageLogger.info("kek");
}
// Создайте новый логгер который будет переиспользовать NormalLogger добавляя к нему сообщение
// с указанием сколько по времени заняло вызвать каждый из методов
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment