X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FGenBuild%2Forg%2Ftianocore%2Fbuild%2Fglobal%2FGenBuildLogger.java;h=9bc3f2d176a80d91e889a2c9ccf475bfde4327b4;hp=e1bafd668a778476c8c90670f84cbf6c7b8aa9a6;hb=c8df018e44c9a88a582472339b645d4087848fd6;hpb=97fc032b57b1d189139df778272942d6eaeb132d diff --git a/Tools/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java b/Tools/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java index e1bafd668a..9bc3f2d176 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java +++ b/Tools/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java @@ -1,38 +1,122 @@ /*++ -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php + Copyright (c) 2006, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -Module Name: - GenBuildLogger.java + Module Name: + GenBuildLogger.java -Abstract: + Abstract: ---*/ + --*/ package org.tianocore.build.global; +import java.io.File; +import java.util.List; +import java.util.Vector; + import org.apache.tools.ant.Project; +import org.tianocore.common.logger.EdkLog; import org.tianocore.common.logger.LogMethod; public class GenBuildLogger implements LogMethod { - private Project project; - public GenBuildLogger(Project project) { + private Project project = null; + + /// + /// flag to present whether cache all msg or not + /// true means not to cache. + /// + private boolean flag = true; + + private List v = null; + + public GenBuildLogger (Project project) { + this.project = project; + } + + public GenBuildLogger (Project project, boolean flag) { this.project = project; + this.flag = flag; + // + // Only flag is false, v will be initialized and used. + // + if (!flag) { + v = new Vector(2048); + } } - public void putMessage(Object msgSource, int msgLevel, String msg) { - if (this.project != null){ + /** + Rules: flag = true: means no cache Action: Print it to console + + flag = false: mean cache all msg exception some special Action: loglevel + is EDK_ALWAYS -- Print but no cache loglevel is EDK_ERROR -- Print and + cache the msg others -- No print and cache the msg + **/ + public synchronized void putMessage(Object msgSource, int msgLevel, + String msg) { + if (this.project == null) { + return; + } + + // + // If msgLevel is always print, then print it + // + switch (msgLevel) { + case EdkLog.EDK_ALWAYS: this.project.log(msg, Project.MSG_INFO); + break; + case EdkLog.EDK_ERROR: + if (flag) { + this.project.log(msg, Project.MSG_ERR); + } else { + this.project.log(msg, Project.MSG_ERR); + v.add(msg); + } + break; + case EdkLog.EDK_WARNING: + if (flag) { + this.project.log(msg, Project.MSG_WARN); + } else { + v.add(msg); + } + break; + case EdkLog.EDK_INFO: + if (flag) { + this.project.log(msg, Project.MSG_INFO); + } else { + v.add(msg); + } + break; + case EdkLog.EDK_VERBOSE: + if (flag) { + this.project.log(msg, Project.MSG_VERBOSE); + } else { + v.add(msg); + } + break; + case EdkLog.EDK_DEBUG: + if (flag) { + this.project.log(msg, Project.MSG_DEBUG); + } else { + v.add(msg); + } + break; } + } + + public void flushToFile(File file) { + // + // Sort msg and store to the file (TBD) + // } } \ No newline at end of file