Update logging
This commit is contained in:
@@ -10,6 +10,12 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'org.slf4j:slf4j-api:2.0.17'
|
||||
implementation 'ch.qos.logback:logback-classic:1.5.25'
|
||||
|
||||
compileOnly 'org.projectlombok:lombok:1.18.42'
|
||||
annotationProcessor 'org.projectlombok:lombok:1.18.42'
|
||||
|
||||
testImplementation platform('org.junit:junit-bom:5.10.0')
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter'
|
||||
}
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
package ru.ilug.c1_word_counter;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
public class MainTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
WordCounter wordCounter = null;
|
||||
WordCounter wordCounter = new WordCounterImpl();
|
||||
|
||||
String text = "Внутри Map данные хранятся в формате “ключ”-”значение”, то есть по парам. И в качестве ключей, и в качестве значений могут выступать любые объекты — числа, строки или объекты других классов.";
|
||||
String text = "Внутри Map данные хранятся в формате ключ значение, то есть по парам. И в качестве ключей, и в качестве значений могут выступать любые объекты числа, строки или объекты других классов.";
|
||||
Map<String, Integer> wordsCountMap = wordCounter.countWords(text);
|
||||
|
||||
System.out.println("Words count: " + wordsCountMap);
|
||||
log.info("Words count: {}", wordsCountMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package ru.ilug.c2_phone_book;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class MainTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
@@ -10,12 +13,12 @@ public class MainTest {
|
||||
phoneBook.addContact("Andrey", "+8 (910) 111 21 31");
|
||||
phoneBook.addContact("Maria", "+4 (234) 567 89 10");
|
||||
|
||||
System.out.println("Maria phone: " + phoneBook.findPhoneByName("Maria"));
|
||||
System.out.println("Dima phone: " + phoneBook.findPhoneByName("Dima"));
|
||||
log.info("Maria phone: {}", phoneBook.findPhoneByName("Maria"));
|
||||
log.info("Dima phone: {}", phoneBook.findPhoneByName("Dima"));
|
||||
|
||||
phoneBook.removeContactByName("Dima");
|
||||
|
||||
System.out.println("Dima phone: " + phoneBook.findPhoneByName("Dima"));
|
||||
log.info("Dima phone: {}", phoneBook.findPhoneByName("Dima"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package ru.ilug.c3_simple_translator;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class MainTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
@@ -16,8 +19,8 @@ public class MainTest {
|
||||
String text1 = "Подборка практических задач";
|
||||
String text2 = "Статистическая оценка линии производства";
|
||||
|
||||
System.out.println(text1 + " -> " + simpleTranslator.translate(text1));
|
||||
System.out.println(text2 + " -> " + simpleTranslator.translate(text2));
|
||||
log.info("{} -> {}", text1, simpleTranslator.translate(text1));
|
||||
log.info("{} -> {}", text2, simpleTranslator.translate(text2));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package ru.ilug.c4_school_journal;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
public class MainTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
@@ -15,13 +18,13 @@ public class MainTest {
|
||||
schoolJournal.addScore("Alexandr", 3);
|
||||
|
||||
Map<String, Float> averagesScores = schoolJournal.getAverageScorePerStudent();
|
||||
System.out.println("Average students scores: " + averagesScores);
|
||||
log.info("Average students scores: {}", averagesScores);
|
||||
|
||||
List<String> students1 = schoolJournal.studentsWithAverageScoreHighThen(4.5f);
|
||||
System.out.println("Students with average score high then 4.5:" + students1);
|
||||
log.info("Students with average score high then 4.5:{}", students1);
|
||||
|
||||
List<String> students2 = schoolJournal.studentsWithAverageScoreHighThen(3);
|
||||
System.out.println("Students with average score high then 3:" + students2);
|
||||
log.info("Students with average score high then 3:{}", students2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package ru.ilug.c5_char_frequency;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class MainTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
@@ -8,8 +11,8 @@ public class MainTest {
|
||||
String text1 = "Мама мыла Милку мылом";
|
||||
String text2 = "Карл у Клары украл рекламу, а Клара у Карла украла бюджет.";
|
||||
|
||||
System.out.println("First char frequency: " + charFrequency.getSortedCharFrequency(text1));
|
||||
System.out.println("Second char frequency: " + charFrequency.getSortedCharFrequency(text2));
|
||||
log.info("First char frequency: {}", charFrequency.getSortedCharFrequency(text1));
|
||||
log.info("Second char frequency: {}", charFrequency.getSortedCharFrequency(text2));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package ru.ilug.c6_word_group;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class MainTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
@@ -8,8 +11,8 @@ public class MainTest {
|
||||
String text1 = "Карл у Клары украл рекламу, а Клара у Карла украла бюджет.";
|
||||
String text2 = "Из кузова в кузов шла перегрузка арбузов. В грозу, в грязи от груза арбузов развалился кузов.";
|
||||
|
||||
System.out.println("First grouped words: " + wordGroup.groupWordsByLength(text1));
|
||||
System.out.println("Second grouped words: " + wordGroup.groupWordsByLength(text2));
|
||||
log.info("First grouped words: {}", wordGroup.groupWordsByLength(text1));
|
||||
log.info("Second grouped words: {}", wordGroup.groupWordsByLength(text2));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user