Autopsy  4.15.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
LoggingProgressIndicator.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2017 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.progress;
20 
21 import java.util.logging.Level;
23 
27 public final class LoggingProgressIndicator implements ProgressIndicator {
28 
29  private final Logger LOGGER = Logger.getLogger(LoggingProgressIndicator.class.getName());
30  private int totalWorkUnits;
31 
32  @Override
33  public void start(String message, int totalWorkUnits) {
34  this.totalWorkUnits = totalWorkUnits;
35  LOGGER.log(Level.INFO, "{0} started, {1} total work units", new Object[]{message, this.totalWorkUnits});
36  }
37 
38  @Override
39  public void start(String message) {
40  LOGGER.log(Level.INFO, "{0}", message);
41  }
42 
43  @Override
44  public void switchToIndeterminate(String message) {
45  this.totalWorkUnits = 0;
46  LOGGER.log(Level.INFO, "{0}", message);
47  }
48 
49  @Override
50  public void switchToDeterminate(String message, int workUnitsCompleted, int totalWorkUnits) {
51  this.totalWorkUnits = totalWorkUnits;
52  LOGGER.log(Level.INFO, "{0}, {1} of {2} total work units completed", new Object[]{message, workUnitsCompleted, this.totalWorkUnits});
53  }
54 
55  @Override
56  public void progress(String message) {
57  LOGGER.log(Level.INFO, "{0}", message);
58  }
59 
60  @Override
61  public void progress(int workUnitsCompleted) {
62  LOGGER.log(Level.INFO, "{0} of {1} total work units completed", new Object[]{workUnitsCompleted, this.totalWorkUnits});
63  }
64 
65  @Override
66  public void progress(String message, int workUnitsCompleted) {
67  LOGGER.log(Level.INFO, "{0}, {1} of {2} total work units completed", new Object[]{message, workUnitsCompleted, this.totalWorkUnits});
68  }
69 
70  @Override
71  public void finish() {
72  LOGGER.log(Level.INFO, "Finished");
73  }
74 
75 }
void progress(String message, int workUnitsCompleted)
void switchToDeterminate(String message, int workUnitsCompleted, int totalWorkUnits)
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2020 Basis Technology. Generated on: Mon Jul 6 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.