1/* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { paramMock } from "../utils" 17 18export function mockHilog() { 19 const hilog = { 20 LogLevel: { 21 DEBUG: 3, 22 INFO: 4, 23 WARN: 5, 24 ERROR: 6, 25 FATAL: 7 26 }, 27 debug: function (...args) { 28 console.warn("hilog.debug interface mocked in the Previewer. How this interface works on the" + 29 " Previewer may be different from that on a real device.") 30 }, 31 info: function (...args) { 32 console.warn("hilog.info interface mocked in the Previewer. How this interface works on the" + 33 " Previewer may be different from that on a real device.") 34 }, 35 warn: function (...args) { 36 console.warn("hilog.warn interface mocked in the Previewer. How this interface works on the" + 37 " Previewer may be different from that on a real device.") 38 }, 39 error: function (...args) { 40 console.warn("hilog.error interface mocked in the Previewer. How this interface works on the" + 41 " Previewer may be different from that on a real device.") 42 }, 43 fatal: function (...args) { 44 console.warn("hilog.fatal interface mocked in the Previewer. How this interface works on the" + 45 " Previewer may be different from that on a real device.") 46 }, 47 isLoggable: function (...args) { 48 console.warn("hilog.isLoggable interface mocked in the Previewer. How this interface works on the" + 49 " Previewer may be different from that on a real device.") 50 return paramMock.paramBooleanMock; 51 } 52 } 53 return hilog; 54} 55