Skip to content

Commit 156524f

Browse files
committed
新增全局日志存储方式自动化配置类ApiBootLoggingGlobalLogStorageAutoConfiguration
1 parent 69ca38d commit 156524f

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright [2019] [恒宇少年 - 于起宇]
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
package org.minbox.framework.api.boot.autoconfigure.logging;
19+
20+
import org.minbox.framework.logging.client.global.GlobalLogging;
21+
import org.minbox.framework.logging.client.global.support.GlobalLoggingMemoryStorage;
22+
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
23+
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
24+
import org.springframework.context.annotation.Bean;
25+
import org.springframework.context.annotation.Configuration;
26+
27+
import static org.minbox.framework.api.boot.autoconfigure.logging.ApiBootLoggingProperties.API_BOOT_LOGGING_PREFIX;
28+
29+
/**
30+
* the "minbox-logging" global log storage configuration
31+
*
32+
* @author 恒宇少年
33+
*/
34+
@Configuration
35+
@ConditionalOnClass(GlobalLogging.class)
36+
public class ApiBootLoggingGlobalLogStorageAutoConfiguration {
37+
/**
38+
* Instance global log memory mode storage
39+
*
40+
* @return {@link GlobalLoggingMemoryStorage}
41+
*/
42+
@Bean
43+
@ConditionalOnProperty(prefix = API_BOOT_LOGGING_PREFIX,
44+
name = "global-logging-storage-away", havingValue = "memory", matchIfMissing = true)
45+
public GlobalLogging globalLogging() {
46+
return new GlobalLoggingMemoryStorage();
47+
}
48+
}

0 commit comments

Comments
 (0)